File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %target-run-simple-swift | %FileCheck %s
2+
3+ // https://github.com/swiftlang/swift/issues/85020
4+
5+ struct Store {
6+ let theType : Any . Type
7+
8+ init ( of theType: Any . Type ) {
9+ print ( " init from TYPE: \( theType) " )
10+ self . theType = theType
11+ }
12+
13+ init ( of instance: Any ) {
14+ print ( " init from VALUE: \( instance) " )
15+ self . init ( of: type ( of: instance) )
16+ }
17+ }
18+
19+ let a : ( any Numeric ) ? = 42
20+ print ( " a: \( type ( of: a) ) " )
21+ // CHECK: a: Optional<Numeric>
22+
23+ let storeA = Store ( of: a!)
24+ // CHECK-NEXT: init from VALUE: 42
25+ // CHECK-NEXT: init from TYPE: Int
26+
27+ let b : ( any Numeric . Type ) ? = type ( of: 42 )
28+ print ( " b: \( type ( of: b) ) " )
29+ // CHECK-NEXT: b: Optional<Numeric.Type>
30+
31+ let storeB = Store ( of: b!)
32+ // CHECK-NEXT: init from TYPE: Int
33+
You can’t perform that action at this time.
0 commit comments