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
Note: both the vm and dart2js have explicit logic to permit function literals inside parenthesized expressions, list literals, map literals, and function arguments. I suspect it was an oversight not to apply similar logic to string interpolation.
The text was updated successfully, but these errors were encountered:
Both the vm and dart2js reject the following code, which is allowed by the spec:
class C {
String s;
C(x) : s = "2x is ${() { return 2x; }()}"; // error
}
The problem only occurs inside initializers, so for example this works just fine:
String s = "2x is ${() { return 2x; }()}"; // ok
See also issue #11509.
Note: both the vm and dart2js have explicit logic to permit function literals inside parenthesized expressions, list literals, map literals, and function arguments. I suspect it was an oversight not to apply similar logic to string interpolation.
The text was updated successfully, but these errors were encountered: