Skip to content

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

Closed
@DartBot

Description

@DartBot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.closed-not-plannedClosed as we don't intend to take action on the reported issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions