Skip to content

VM treats an additive expression with strings literals as a constant expression #961

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
DartBot opened this issue Dec 26, 2011 · 3 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-not-planned Closed as we don't intend to take action on the reported issue

Comments

@DartBot
Copy link

DartBot commented Dec 26, 2011

This issue was originally filed by ms...@unipro.ru


What steps will reproduce the problem?
Run the following test:
class C {
  static final String s = "One" + "Two";
}

main() {
  print(C.s);
}

What is the expected output? What do you see instead?
Expected: compile-time error.
Actual: "OneTwo"

What version of the product are you using? On what operating system?
Dart VM r2810, Ubuntu 10.04

Please provide any additional information below.
According to the section 10.1 of the Language Specification, "An expression of one of the forms e1+e2, e1 - e2, e1 * e2, e1 / e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, where e1 and e2 are constant expressions that evaluate to a numeric value."
can be a constant expression, but an additive expression with string literals can't.

@dgrove
Copy link
Contributor

dgrove commented Jan 2, 2012

Added Area-VM, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jan 3, 2012

This comment was originally written by @mhausner


An earlier version of the language spec specified "a" + "b" to be a compile time constant. I don't see this in the current version of the spec. Will check with Gilad.


Set owner to @mhausner.

@DartBot
Copy link
Author

DartBot commented Jan 4, 2012

This comment was originally written by @mhausner


Spoke with Gilad. This is an omission in the language spec. He'll fix the spec, to allow concatenation of two compile time constant string literals with + to be a compile time constant.


Added WontFix label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Jan 4, 2012
@kevmoo kevmoo added closed-not-planned Closed as we don't intend to take action on the reported issue and removed resolution-wont_fix labels Mar 1, 2016
dart-bot pushed a commit that referenced this issue Nov 19, 2020
2020-11-19 sgrekhov@unipro.ru #926.Add Platform.executableArguments to Process.run() command to not to fail on --enable-assert configuration
2020-11-19 sgrekhov@unipro.ru #926.Add Platform.executableArguments to Process.run() command to not to fail on --enable-assert configuration
2020-11-18 sgrekhov@unipro.ru Fixes #966. Move certificates to RawSecureServerSocket directory
2020-11-18 sgrekhov@unipro.ru #926. Fixed test that fail on precompiled environment in a strong mode
2020-11-17 sgrekhov@unipro.ru Fixes #951. Remove excessive @static-warning
2020-11-17 irina.arkhipets@gmail.com Fixes #946: LanguageFeatures/Instantiate-to-bound/nonfunction_typedef tests updated according to the SDK changes, missing tests added.
2020-11-17 sgrekhov@unipro.ru #932. Some HttpRequest tests fixed to work well with cross origin requests
2020-11-16 sgrekhov@unipro.ru Process kill test fixed to work on different platforms
2020-11-16 sgrekhov@unipro.ru External variable test that expects compile time error on dart2js added
2020-11-13 sgrekhov@unipro.ru Fixes #926. Remove "--enable-experiment=non-nullable" option from script that runs another process
2020-11-12 sgrekhov@unipro.ru #926. File lock checking tests rewritten to not to fail on precompiled environment. Second part
2020-11-12 irina.arkhipets@gmail.com Fixes #602: Missing issue tags added.
2020-11-11 sgrekhov@unipro.ru #926. File lock checking tests rewritten to not to fail on precompiled environment
2020-11-11 sgrekhov@unipro.ru Issue numbers added
2020-11-11 irina.arkhipets@gmail.com Fixes #963: test expected result corrected, test template for all generic typedefs updated.
2020-11-10 sgrekhov@unipro.ru #926. ProcessSignal tests rewritten to not to fail on precompiled environment
2020-11-10 sgrekhov@unipro.ru #926. Process tests rewritten to not to fail on precompiled environment
2020-11-10 sgrekhov@unipro.ru #961. Process tests rewritten to not to use process_test tool
2020-11-10 irina.arkhipets@gmail.com Fixes #602: Missing Issue tag added.
2020-11-10 sgrekhov@unipro.ru Fixes #960. Null safety execution modes renamed and mentions of obsolete checked mode removed
2020-11-10 sgrekhov@unipro.ru Remove wrong error expectations
2020-11-09 sgrekhov@unipro.ru Fixes #962. Change CFE error messages expectations
2020-11-08 irina.arkhipets@gmail.com Fixes #602: New tests for least and greatest closures added.

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-win-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: I7aff067ec96f762490de15daa20c40dff2b0ae96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172940
Reviewed-by: William Hesse <whesse@google.com>
This issue was closed.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-not-planned Closed as we don't intend to take action on the reported issue
Projects
None yet
Development

No branches or pull requests

3 participants