-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rosetta): correctly detect arguments typed as
any
(#3043)
Try and resolve the containing function call. If it resolves, we know the `any` the typechecker is giving us is actually intended to be an `any`. If the containing call does not resolve, we'll treat it as an unknown type of an uncompiling sample, and assume there's a struct there. Fixes #3029. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
- Loading branch information
Showing
8 changed files
with
66 additions
and
8 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
3 changes: 3 additions & 0 deletions
3
packages/jsii-rosetta/test/translations/structs/any_type_never_a_struct.cs
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,3 @@ | ||
FunctionThatTakesAnAny(new Dictionary<string, int> { | ||
{ "argument", 5 } | ||
}); |
2 changes: 2 additions & 0 deletions
2
packages/jsii-rosetta/test/translations/structs/any_type_never_a_struct.java
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,2 @@ | ||
functionThatTakesAnAny(Map.of( | ||
"argument", 5)); |
3 changes: 3 additions & 0 deletions
3
packages/jsii-rosetta/test/translations/structs/any_type_never_a_struct.py
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,3 @@ | ||
function_that_takes_an_any({ | ||
"argument": 5 | ||
}) |
6 changes: 6 additions & 0 deletions
6
packages/jsii-rosetta/test/translations/structs/any_type_never_a_struct.ts
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,6 @@ | ||
/// !hide | ||
function functionThatTakesAnAny(opts: any) { } | ||
/// !show | ||
functionThatTakesAnAny({ | ||
argument: 5 | ||
}); |