-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dart2js
not compiling lambda with the correct parameter type.
#56822
Comments
Summary: The issue is that |
If you need to investigate the generated JS code, force
targets:
$default:
builders:
build_web_compilers:entrypoint:
options:
dart2js_args:
- -O1
- --no-minify
- --disable-program-split
- --no-source-maps
|
The inferred static type of the closure is indeed This is because the array ultimately comes directly from /cc @srujzs @rakudrama |
I guess the real issue then is that Consider using |
For me this is a bug on |
I agree (although DDC working doesn't necessarily indicate that), but this is a problem that materializes specifically for import 'package:web/web.dart' as web;
void main() {
web.window.speechSynthesis.getVoices().toDart.map((e) => e.lang).toList();
} |
@srujzs I'm currently avoiding the bug with this: import 'dart:html';
...
var voicesLang = voices
.map((Object? e) => e is SpeechSynthesisVoice ? e.lang : null)
.nonNulls
.toSet(); |
I've encountered an unusual issue with
dart2js
and have isolated a code snippet that reproduces the bug:DDC
anddart2js
.DDC
.dart2js
(in webdev release mode).Note that the list
voices
needs to be populated to reproduce the bug.I'm not sure of the exact issue, but it seems that the compiled JS is expecting a different type for the map lambda parameter.
Run it:
Open in the browser:
http://127.0.0.1:8080
Browser Console output:
$>
dart info
pubspec.lock
:The text was updated successfully, but these errors were encountered: