Skip to content

[DDC] Constant/final variable + setter = failure on DDC #63477

@sgrekhov

Description

@sgrekhov

If there is a final variable and a setter with the same basename, then invoking the setter produces an error in DDC.

const c1 = 1;
void set c1(int _) {}

main() {
  c1 = 42; // Error here.
}

The following tests fail on DDC:
https://github.com/dart-lang/co19/blob/master/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t01.dart
https://github.com/dart-lang/co19/blob/master/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t02.dart

The output:

/==============================================================================================================================\
| co19/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t01 is new and failed (RuntimeError, expected Pass) |
\==============================================================================================================================/

--- Command "ddc" (took 32ms):
DART_CONFIGURATION=ReleaseX64 CHROME_PATH=/b/s/w/ir/third_party/browsers/chrome/chrome/google-chrome out/ReleaseX64/dart-sdk/bin/dartaotruntime out/ReleaseX64/dart-sdk/bin/snapshots/dartdevc_aot.dart.snapshot -Dtest_runner.configuration=ddc-linux-chrome -Dtest_runner.configuration=ddc-linux-chrome --ignore-unrecognized-flags --no-summarize -o /b/s/w/ir/out/ReleaseX64/generated_compilations/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t01/final_A03_t01.js /b/s/w/ir/tests/co19/src/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t01.dart -s /b/s/w/ir/out/ReleaseX64/gen/utils/ddc/expect_outline.dill=expect -s /b/s/w/ir/out/ReleaseX64/gen/utils/ddc/js_outline.dill=js -s /b/s/w/ir/out/ReleaseX64/gen/utils/ddc/meta_outline.dill=meta

exit code:
0

--- Command "chrome" (took 451ms):
/b/s/w/ir/tools/sdks/dart-sdk/bin/dart pkg/test_runner/bin/launch_browser.dart chrome http://127.0.0.1:41033/root_build/generated_tests/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t01/test.html?crossOriginPort=34065

Runtime error:
TypeError: Cannot set property c1 of [object Object] which has only a getter
    at Object.main (http://127.0.0.1:41033/root_dart/out/ReleaseX64/generated_compilations/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t01/final_A03_t01.js:147:22)
    at testMainWrapper (http://127.0.0.1:41033/root_build/generated_tests/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t01/test.html?crossOriginPort=34065:71:119)

Deobfuscated error and stack:
TypeError: Cannot set property c1 of [object Object] which has only a getter
    at Object.main     ../../../../../tests/co19/src/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t01.dart 60:3
    at testMainWrapper out/ReleaseX64/generated_tests/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t01/test.html 71:119


exit code:
0

--- To debug locally, run:
/b/s/w/ir/tools/sdks/dart-sdk/bin/dart /b/s/w/ir/pkg/test_runner/bin/http_server.dart -p 41033 -c 34065 --network 127.0.0.1 --build-directory=/b/s/w/ir/out/ReleaseX64/ --runtime=chrome --packages=/b/s/w/ir/.dart_tool/package_config.json

--- Re-run this test:
python3 tools/test.py -n ddc-linux-chrome co19/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t01


/==============================================================================================================================\
| co19/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t02 is new and failed (RuntimeError, expected Pass) |
\==============================================================================================================================/

--- Command "ddc" (took 23ms):
DART_CONFIGURATION=ReleaseX64 CHROME_PATH=/b/s/w/ir/third_party/browsers/chrome/chrome/google-chrome out/ReleaseX64/dart-sdk/bin/dartaotruntime out/ReleaseX64/dart-sdk/bin/snapshots/dartdevc_aot.dart.snapshot -Dtest_runner.configuration=ddc-linux-chrome -Dtest_runner.configuration=ddc-linux-chrome --ignore-unrecognized-flags --no-summarize -o /b/s/w/ir/out/ReleaseX64/generated_compilations/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t02/final_A03_t02.js /b/s/w/ir/tests/co19/src/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t02.dart -s /b/s/w/ir/out/ReleaseX64/gen/utils/ddc/expect_outline.dill=expect -s /b/s/w/ir/out/ReleaseX64/gen/utils/ddc/js_outline.dill=js -s /b/s/w/ir/out/ReleaseX64/gen/utils/ddc/meta_outline.dill=meta

exit code:
0

--- Command "chrome" (took 190ms):
/b/s/w/ir/tools/sdks/dart-sdk/bin/dart pkg/test_runner/bin/launch_browser.dart chrome http://127.0.0.1:45355/root_build/generated_tests/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t02/test.html?crossOriginPort=34135

Runtime error:
TypeError: Cannot set property c1 of [object Object] which has only a getter
    at Object.main (http://127.0.0.1:45355/root_dart/out/ReleaseX64/generated_compilations/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t02/final_A03_t02.js:289:22)
    at testMainWrapper (http://127.0.0.1:45355/root_build/generated_tests/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t02/test.html?crossOriginPort=34135:71:119)

Deobfuscated error and stack:
TypeError: Cannot set property c1 of [object Object] which has only a getter
    at Object.main     ../../../../../tests/co19/src/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t02.dart 75:3
    at testMainWrapper out/ReleaseX64/generated_tests/ddc-linux-chrome/tests_co19_src_Language_Variables_Implicitly_Induced_Getters_and_Setters_final_A03_t02/test.html 71:119


exit code:
0

--- To debug locally, run:
/b/s/w/ir/tools/sdks/dart-sdk/bin/dart /b/s/w/ir/pkg/test_runner/bin/http_server.dart -p 45355 -c 34135 --network 127.0.0.1 --build-directory=/b/s/w/ir/out/ReleaseX64/ --runtime=chrome --packages=/b/s/w/ir/.dart_tool/package_config.json

--- Re-run this test:
python3 tools/test.py -n ddc-linux-chrome co19/Language/Variables/Implicitly_Induced_Getters_and_Setters/final_A03_t02

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.triagedIssue has been triaged by sub teamweb-dev-compiler

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions