@@ -14,6 +14,73 @@ fun test() {
14
14
------------------------------------------------------------------------
15
15
8:6 -> 2:12 resolved
16
16
17
+ ========================================================================
18
+ Extends method resolve on T? with non Option qualifier
19
+ ========================================================================
20
+ primitive Int;
21
+
22
+ extends fun add(self: Int?, other: Int): Int {
23
+ return self + other;
24
+ }
25
+
26
+ fun test() {
27
+ let x: Int = 5;
28
+ x.<caret>add(3);
29
+ }
30
+ ------------------------------------------------------------------------
31
+ 8:6 -> 2:12 resolved
32
+
33
+ ========================================================================
34
+ Extends method resolve on T? with Option qualifier
35
+ ========================================================================
36
+ primitive Int;
37
+
38
+ extends fun add(self: Int?, other: Int): Int {
39
+ return self + other;
40
+ }
41
+
42
+ fun test() {
43
+ let x: Int? = 5;
44
+ x.<caret>add(3);
45
+ }
46
+ ------------------------------------------------------------------------
47
+ 8:6 -> 2:12 resolved
48
+
49
+ ========================================================================
50
+ Extends method resolve on T and T? with the same name
51
+ ========================================================================
52
+ primitive Int;
53
+
54
+ struct SomeStruct {}
55
+
56
+ extends fun equal(self: SomeStruct?, other: SomeStruct?): Bool {
57
+ if (self == null && other == null) { return true }
58
+ if (self == null || other == null) { return false }
59
+ return self!!.i == other!!.i && self!!.b == other!!.b;
60
+ }
61
+
62
+ extends fun equal(self: SomeStruct, other: SomeStruct): Bool {
63
+ return self.i == other.i && self.b == other.b;
64
+ }
65
+
66
+ contract Test {
67
+ receive() {}
68
+
69
+ get fun test1(): Bool {
70
+ let s1 = SomeStruct { i: 42, b: true };
71
+ return s1.<caret>equal(s1)
72
+ }
73
+
74
+ get fun test2(): Bool {
75
+ let s2 = SomeStruct { i: 42, b: false };
76
+ let s3: SomeStruct? = null;
77
+ return !s3.<caret>equal(s2);
78
+ }
79
+ }
80
+ ------------------------------------------------------------------------
81
+ 19:18 -> 10:12 resolved
82
+ 25:19 -> 4:12 resolved
83
+
17
84
========================================================================
18
85
Contract method resolve
19
86
========================================================================
0 commit comments