dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.09k stars 1.56k forks source link

fasta: Convert [StringConcatenation]s consisting only of strings to [String]s #28306

Open mkustermann opened 7 years ago

mkustermann commented 7 years ago

The test language/const_string_test tests e.g. identical("abcd", "a" "b" "cd")). This could be handled in the frontend and makes the flow graph builder simpler.

/cc @kmillikin & #28263

mraleph commented 7 years ago

This test seems to still fail with Fasta.

jensjoha commented 6 years ago

That would not solve for instance const d = identical("zyz", "z$yz"); (same test). Updated: Added important "not" in sentence above.

peter-ahe-google commented 6 years ago

We're currently not evaluating const Type.fromEnvironment (where Type is String, bool, int, etc) during Fasta compilation. This is why we can't solve identical("zyz", "z$yz") in general.

peter-ahe-google commented 6 years ago

What is this bug about? As far as I'm concerned, constant folding string literals is "nice to have", not P2.

jensjoha commented 6 years ago

I guess it depends on how you see it --- string folding might be, but making identical work as expected might not be? Feel free to update the priority though.