diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b93a7f123e..8668b06d50e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart index 20b6c1d49ca..83f0eb477a6 100644 --- a/pkg/dev_compiler/lib/src/kernel/compiler.dart +++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart @@ -3519,6 +3519,13 @@ class ProgramCompiler extends ComputeOnceConstantVisitor ? 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)]); } } diff --git a/tests/dartdevc/debugger/debugger_test_golden.txt b/tests/dartdevc/debugger/debugger_test_golden.txt index 353cd8a6c9e..4cad6ccbcab 100644 --- a/tests/dartdevc/debugger/debugger_test_golden.txt +++ b/tests/dartdevc/debugger/debugger_test_golden.txt @@ -7091,7 +7091,7 @@ Value: { "style": "background-color: #d9edf7;color: black" }, - "Instance of 'TestGenericClass'" + "Instance of 'TestGenericClass, int>'" ] ----------------------------------- Test: TestGenericClassJSInterop instance body @@ -7188,7 +7188,7 @@ Value: { "style": "background-color: #d9edf7;color: black" }, - "TestGenericClass" + "TestGenericClass, int>" ] ----------------------------------- Test: TestGenericClassJSInterop definition formatting body diff --git a/tests/dartdevc_2/debugger/debugger_test_golden.txt b/tests/dartdevc_2/debugger/debugger_test_golden.txt index 353cd8a6c9e..4cad6ccbcab 100644 --- a/tests/dartdevc_2/debugger/debugger_test_golden.txt +++ b/tests/dartdevc_2/debugger/debugger_test_golden.txt @@ -7091,7 +7091,7 @@ Value: { "style": "background-color: #d9edf7;color: black" }, - "Instance of 'TestGenericClass'" + "Instance of 'TestGenericClass, int>'" ] ----------------------------------- Test: TestGenericClassJSInterop instance body @@ -7188,7 +7188,7 @@ Value: { "style": "background-color: #d9edf7;color: black" }, - "TestGenericClass" + "TestGenericClass, int>" ] ----------------------------------- Test: TestGenericClassJSInterop definition formatting body