File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,40 @@ import struct ModuleSelectorTestingKit::A
12
12
13
13
let magnitude : Never = fatalError ( )
14
14
15
+ // Test correct code using `A`
16
+
17
+ extension ModuleSelectorTestingKit : : A : @retroactive Swift : : Equatable {
18
+ @_implements ( Swift: : Equatable, == ( _: _: ) )
19
+ public static func equals( _: ModuleSelectorTestingKit : : A, _: ModuleSelectorTestingKit : : A) -> Swift : : Bool {
20
+ Swift: : fatalError( )
21
+ }
22
+
23
+ // FIXME: Add tests with autodiff @_differentiable(jvp:vjp:) and
24
+ // @_derivative(of:)
25
+
26
+ @_dynamicReplacement ( for: ModuleSelectorTestingKit: : negate( ) )
27
+ mutating func myNegate( ) {
28
+ let fn : ( Swift: : Int , Swift : : Int ) -> Swift : : Int =
29
+ ( + )
30
+ // FIXME: it'd be nice to handle module selectors on operators.
31
+
32
+ let magnitude : Int . Swift : : Magnitude = main: : magnitude
33
+ // FIXME incorrect: expected-error@-1 {{variable used within its own initial value}}
34
+ // expected-EVENTUALLY-error@-1 {{something about type mismatch between 'Never' and 'Int.Swift::Magnitude'}}
35
+
36
+ if Swift : : Bool. Swift : : rando m( ) {
37
+ self . ModuleSelectorTestingKit : : negate( )
38
+ }
39
+ else {
40
+ self = ModuleSelectorTestingKit : : A( value: . Swift: : min)
41
+ }
42
+
43
+ self . main : : myNegate( )
44
+ }
45
+
46
+ // FIXME: Can we test @convention(witness_method:)?
47
+ }
48
+
15
49
// Test resolution of main:: using `B`
16
50
17
51
extension main : : B { }
You can’t perform that action at this time.
0 commit comments