mirror of
https://github.com/dart-lang/sdk
synced 2024-07-05 09:20:04 +00:00
[ddc] Show "any" for type args of package js types
Ensures that `toString()` of types that contain embedded js types will appear the same in the old and new runtime type systems. Issue: https://github.com/dart-lang/sdk/issues/48585 Change-Id: I71ec0e13943281e745bcf05e10aa36d093cbc0c3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334003 Commit-Queue: Nicholas Shahan <nshahan@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com>
This commit is contained in:
parent
57ece5b452
commit
c50fcf8828
|
@ -46,6 +46,13 @@
|
|||
|
||||
[lints-3-0]: https://pub.dev/packages/lints/changelog#300
|
||||
|
||||
#### Development JavaScript compiler (DDC)
|
||||
|
||||
- Type arguments of `package:js` interop types are now printed as `any` instead
|
||||
of being omitted. This is simply a change to the textual representation of
|
||||
package js types that have type arguments. These type arguments are still
|
||||
completely ignored by the type system at runtime.
|
||||
|
||||
## 3.2.0
|
||||
|
||||
### Language
|
||||
|
|
|
@ -3519,6 +3519,13 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
? getLocalClassName(c)
|
||||
: _emitJsNameWithoutGlobal(c);
|
||||
if (jsName != null) {
|
||||
if (type.typeArguments.isNotEmpty) {
|
||||
// This does not handle the type arguments as such, it simply includes
|
||||
// them in the textual representation of this type so you can see them
|
||||
// when printed. They are not used as part of the type system at all.
|
||||
jsName =
|
||||
'$jsName<${type.typeArguments.map((_) => 'any').join(', ')}>';
|
||||
}
|
||||
typeRep = runtimeCall('packageJSType(#)', [js.escapedString(jsName)]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7091,7 +7091,7 @@ Value:
|
|||
{
|
||||
"style": "background-color: #d9edf7;color: black"
|
||||
},
|
||||
"Instance of 'TestGenericClass<ExampleJSClass, int>'"
|
||||
"Instance of 'TestGenericClass<ExampleJSClass<any>, int>'"
|
||||
]
|
||||
-----------------------------------
|
||||
Test: TestGenericClassJSInterop instance body
|
||||
|
@ -7188,7 +7188,7 @@ Value:
|
|||
{
|
||||
"style": "background-color: #d9edf7;color: black"
|
||||
},
|
||||
"TestGenericClass<ExampleJSClass, int>"
|
||||
"TestGenericClass<ExampleJSClass<any>, int>"
|
||||
]
|
||||
-----------------------------------
|
||||
Test: TestGenericClassJSInterop definition formatting body
|
||||
|
|
|
@ -7091,7 +7091,7 @@ Value:
|
|||
{
|
||||
"style": "background-color: #d9edf7;color: black"
|
||||
},
|
||||
"Instance of 'TestGenericClass<ExampleJSClass, int>'"
|
||||
"Instance of 'TestGenericClass<ExampleJSClass<any>, int>'"
|
||||
]
|
||||
-----------------------------------
|
||||
Test: TestGenericClassJSInterop instance body
|
||||
|
@ -7188,7 +7188,7 @@ Value:
|
|||
{
|
||||
"style": "background-color: #d9edf7;color: black"
|
||||
},
|
||||
"TestGenericClass<ExampleJSClass, int>"
|
||||
"TestGenericClass<ExampleJSClass<any>, int>"
|
||||
]
|
||||
-----------------------------------
|
||||
Test: TestGenericClassJSInterop definition formatting body
|
||||
|
|
Loading…
Reference in New Issue
Block a user