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