Merge pull request #78248 from Azoy/value-generic-static-member

[NameLookup] Allow value generics to show up as static members
This commit is contained in:
Alejandro Alonso
2025-04-16 08:03:46 -07:00
parent b684e716fe
commit 12919a2300
16 changed files with 256 additions and 38 deletions

View File

@@ -14,6 +14,8 @@ public struct Slab<Element, let N: Int> {
public var count: Int {
N
}
public init() {}
}
// CHECK: public func usesGenericSlab<let N : Swift.Int>(_: ValueGeneric.Slab<Swift.Int, N>)
@@ -24,3 +26,27 @@ public func usesConcreteSlab(_: Slab<Int, 2>) {}
// CHECK: public func usesNegativeSlab(_: ValueGeneric.Slab<Swift.String, -10>)
public func usesNegativeSlab(_: Slab<String, -10>) {}
// CHECK: $ValueGenericsNameLookup
@inlinable
public func test() -> Int {
// CHECK: Slab<Int, 123>.N
Slab<Int, 123>.N
}
// CHECK: $ValueGenericsNameLookup
@inlinable
public func test2() -> Int {
// CHECK: type(of: Slab<Int, 123>()).N
type(of: Slab<Int, 123>()).N
}
// CHECK: $ValueGenericsNameLookup
@inlinable
public func test3() {
{
print(123)
print(123)
print(Slab<Int, 123>.N)
}()
}