You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
frogc r2899
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.
The text was updated successfully, but these errors were encountered:
(cloned from issue #961)
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?
frogc r2899
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.
The text was updated successfully, but these errors were encountered: