swift
7c6a2709 - [Literal Expressions] Prohibit references to `@usableFromInline` `internal` declaration values

Commit
96 days ago
[Literal Expressions] Prohibit references to `@usableFromInline` `internal` declaration values Although a `@usableFromInline` variable cannot be named directly by a client, its value can still reach a client binary: an `@inlinable` function may fold the variable into an integer generic argument, and that folded value is then serialized into the function body that the client inlines. e.g. ```swift @usableFromInline let x = 8, y = 8, z = 8 @usableFromInline func bar(_ zs: [z of Int]) {} @inlinable public func foo() { let xs: [x of Int] = [1, 2, 3, 4, 5, 6, 7, 8] let ys: [y of Int] = xs bar(ys) } ``` A subsequent change to the folded value would leave already-compiled clients inconsistent with the evolved module, so the variable's value is, in effect, part of the ABI.
Author
Committer
Parents
Loading