-
-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MNullable monomorph modifier (#11851)
* add MNullable * move MOpenStructure to tm_modifiers too * remove MEmptyStructure * Revert "remove MEmptyStructure" This reverts commit 47c1f5b. * remove Alex' unused monomorph collection * small cleanup
- Loading branch information
Showing
16 changed files
with
186 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
MainBar.hx:6: characters 18-21 : Field bar has different type than in Foo | ||
MainBar.hx:2: characters 11-14 : ... Interface field is defined here | ||
MainBar.hx:6: characters 18-21 : ... error: Null<Unknown<0>> should be bar.T | ||
MainBar.hx:6: characters 18-21 : ... have: (...) -> Null<...> | ||
MainBar.hx:6: characters 18-21 : ... have: (...) -> Null<Unknown<0>> | ||
MainBar.hx:6: characters 18-21 : ... want: (...) -> bar.T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
MainFoo.hx:6: characters 18-21 : Field foo has different type than in Foo | ||
MainFoo.hx:2: characters 11-14 : ... Interface field is defined here | ||
MainFoo.hx:6: characters 18-21 : ... error: Null<Unknown<0>> should be foo.T | ||
MainFoo.hx:6: characters 18-21 : ... have: (...) -> Null<...> | ||
MainFoo.hx:6: characters 18-21 : ... have: (...) -> Null<Unknown<0>> | ||
MainFoo.hx:6: characters 18-21 : ... want: (...) -> foo.T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class Main { | ||
static var doThings : Foo -> Void; | ||
|
||
static function main() { | ||
var foo = new Foo(); | ||
doThings = (foo -> doThingsImpl(foo)); | ||
doThings(foo); | ||
} | ||
|
||
static function doThingsImpl(foo) { | ||
foo.doWithBar(); | ||
$type(foo); | ||
$type(foo.doWithBar); | ||
|
||
if (foo != null) trace(foo); | ||
$type(foo); | ||
$type(foo.doWithBar); | ||
} | ||
} | ||
|
||
class Foo { | ||
public function new() {} | ||
public function doWithBar(?bar:Bar) { | ||
trace(bar); | ||
} | ||
} | ||
|
||
@:keep | ||
class Bar { | ||
public function new() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class Foo { | ||
public function new() {} | ||
|
||
public function test() {} | ||
|
||
public function doWithBar(?bar:Bar) { | ||
trace(bar); | ||
} | ||
} | ||
|
||
@:keep | ||
class Bar { | ||
public function new() {} | ||
} | ||
|
||
function doThingsImpl(foo) { | ||
$type(foo); // Unknown<0> | ||
foo.doWithBar(); | ||
$type(foo); // Unknown<0> : { doWithBar : () -> Unknown<1> } | ||
$type(foo.doWithBar); // () -> Unknown<0> | ||
if (foo != null) | ||
trace(foo); | ||
$type(foo); // Null<{ doWithBar : () -> Unknown<0> }> | ||
$type(foo.doWithBar); // () -> Unknown<0> | ||
foo.test(); // Null<{ doWithBar : () -> Unknown<0> }> has no field test | ||
} | ||
|
||
function main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-main Main | ||
--hl bin/main.hl | ||
-D message.reporting=pretty | ||
-D message.no-color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[WARNING] Main.hx:12: characters 9-12 | ||
|
||
12 | $type(foo); | ||
| ^^^ | ||
| Unknown<0> : { doWithBar : () -> Unknown<1> } | ||
|
||
[WARNING] Main.hx:13: characters 9-22 | ||
|
||
13 | $type(foo.doWithBar); | ||
| ^^^^^^^^^^^^^ | ||
| () -> Unknown<0> | ||
|
||
[WARNING] Main.hx:16: characters 9-12 | ||
|
||
16 | $type(foo); | ||
| ^^^ | ||
| Null<Unknown<0> : { doWithBar : () -> Unknown<1> }> | ||
|
||
[WARNING] Main.hx:17: characters 9-22 | ||
|
||
17 | $type(foo.doWithBar); | ||
| ^^^^^^^^^^^^^ | ||
| () -> Unknown<0> | ||
|
||
[ERROR] Main.hx:6: characters 35-38 | ||
|
||
6 | doThings = (foo -> doThingsImpl(foo)); | ||
| ^^^ | ||
| error: (?bar : Null<Bar>) -> Void should be () -> Unknown<0> | ||
| have: { doWithBar: (?...) -> ... } | ||
| want: { doWithBar: () -> ... } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-main Main2 | ||
--hl bin/main.hl | ||
-D message.reporting=pretty | ||
-D message.no-color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[WARNING] Main2.hx:17: characters 8-11 | ||
|
||
17 | $type(foo); // Unknown<0> | ||
| ^^^ | ||
| Unknown<0> | ||
|
||
[WARNING] Main2.hx:19: characters 8-11 | ||
|
||
19 | $type(foo); // Unknown<0> : { doWithBar : () -> Unknown<1> } | ||
| ^^^ | ||
| Unknown<0> : { doWithBar : () -> Unknown<1> } | ||
|
||
[WARNING] Main2.hx:20: characters 8-21 | ||
|
||
20 | $type(foo.doWithBar); // () -> Unknown<0> | ||
| ^^^^^^^^^^^^^ | ||
| () -> Unknown<0> | ||
|
||
[WARNING] Main2.hx:23: characters 8-11 | ||
|
||
23 | $type(foo); // Null<{ doWithBar : () -> Unknown<0> }> | ||
| ^^^ | ||
| Null<Unknown<0> : { doWithBar : () -> Unknown<1> }> | ||
|
||
[WARNING] Main2.hx:24: characters 8-21 | ||
|
||
24 | $type(foo.doWithBar); // () -> Unknown<0> | ||
| ^^^^^^^^^^^^^ | ||
| () -> Unknown<0> |