-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing monomorph issue for objectLiterals
- Loading branch information
Showing
5 changed files
with
115 additions
and
32 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
45 changes: 45 additions & 0 deletions
45
src/test/resources/testData/inlay/haxe.local.variable/ComplexMonomorphHints.hx
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,45 @@ | ||
package testData.inlay.haxe.local.variable; | ||
|
||
typedef ObjectDefinition<T> = { | ||
array:Array<T> | ||
} | ||
|
||
class ComplexTypeParameterMonomorphTest { | ||
|
||
public function testMethodCall() { | ||
|
||
// this variable should get ":Array<String>" from BuildContext parameter type | ||
// issues with recursion guard and incorrect caching will incorrectly cause this to become ":Array<Int>" | ||
var testArray/*<# :Array<String> #>*/ = []; | ||
|
||
morphByParameter({array: testArray }); | ||
|
||
// its important that the monomorph of "testArray" does not try to pick up its type from this usage | ||
// it will then default to Array<Int> as the parameters are optional and it we would incorreclty | ||
// use the first one | ||
|
||
useMorphedValue(testArray); | ||
} | ||
public function testFunctionType(morphByFunctionCall:ObjectDefinition<Float>->Void) { | ||
|
||
// this variable should get ":Array<Float>" from the parameter type BuildContext as part as the fuctionType | ||
// issues with recursion guard and incorrect caching will incorrectly cause this to become ":Array<Int>" | ||
var testArray/*<# :Array<Float> #>*/ = []; | ||
|
||
morphByFunctionCall({array: testArray }); | ||
|
||
// its important that the monomorph of "testArray" does not try to pick up its type from this usage | ||
// it will then default to Array<Int> as the parameters are optional and it we would incorreclty | ||
// use the first one | ||
|
||
useMorphedValue(testArray); | ||
} | ||
|
||
public function fromOptional() { | ||
|
||
var testArray/*<# :Array<Int> #>*/ = []; | ||
useMorphedValue(testArray); | ||
} | ||
public static function morphByParameter(value:ObjectDefinition<String>) {} | ||
public static function useMorphedValue(?optional1:Array<Int>, ?optional2:Array<String>, ?optional3:Array<Float>) {} | ||
} |