New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String concatenation error: String + String not a constant operation. #15853
Comments
This is (sadly) working as intended. The "+" operator on Strings was introduced later in the language's life, when that list was already written, so we should consider adding it as well. I'm making this an enhancement request on the specification, to add String + String as a constant expression. cc @gbracha. |
Please add 'String * int' as a constant expression as well as 'String + String'. |
String * int? |
"foo" * 3 => "foofoofoo" |
So String+ String is a constant (and has been for a while). String* int isn't and is not expected to be. Added Done label. |
This comment was originally written by @mezoni
Is this also constant? "foofoofoo" ~/ 3 => "foo" |
Sorry, only (integer) scalar multiplication is available, there are no multiplicative inverses on strings. |
This issue was originally filed by zharvey198...@gmail.com
What steps will reproduce the problem?
http://stackoverflow.com/questions/20883018/dart-string-concatenation-error-exptected-type-is-num
What is the expected output? What do you see instead?
Expected Dart to allow string to be concatenated. Instead Dart issues compiler error stating "An expression of type 'num' was expected."
What version of the product are you using? On what operating system?
Dart 1.0.0 (r30798)
64-bit Ubuntu 12.04
Please provide any additional information below.
The text was updated successfully, but these errors were encountered: