DDC should move away from using JS default arguments for Dart methods with default parameters #55884
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
dart2js-ddc-discrepancy
When dev and production compilations have different semantics
web-dev-compiler
The above prints
default
on DDC andnull
on dart2js (alsonull
on dart2wasm, but that's because of how it's converted tonull
explicitly). This is because DDC lowersf
to something like:When
undefined
is passed, JS uses the default value instead. This is generally an okay way to lower this code ifundefined
never exists in the program, but with JS interop, that can't be guaranteed. Another way to reproduce this discrepancy is converting the above Dart function to JS and then calling it withundefined
.cc @nshahan
The text was updated successfully, but these errors were encountered: