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
In the following Vala example the string argument of date.format inside a string template gets formatted (spaces are added), which shouldn't be the case and makes the URL invalid.
test file:
publicvoid main () {
var date =newDateTime.now_local ();
string language ="en";
string url =@"https://api.wikimedia.org/feed/v1/wikipedia/$language/featured/$(date.format ("%Y/%m/%d"))";
print(url)
}
generated result:
publicvoid main () {
var date =newDateTime.now_local ();
string language ="en";
string url =@"https://api.wikimedia.org/feed/v1/wikipedia/$language/featured/$(date.format ("%Y/%m/%d "))";
print(url)
}
Why is the ", at line 7 column 89 NOT the closing of the string, beginning at column 10
Well, I don't know how the Vala compiler works, but in the string template $(....) is an expression and so the " at line 7 column 89, which appears in that expression (before the bracket after the $-sign is closed) cannot be the closing of the string.
From this Vala tutorial
Strings prefixed with '@' are string templates. They can evaluate embedded variables and expressions prefixed with '$':
int a =6, b =7;
string s =@"$a * $b = $(a * b)"; // => "6 * 7 = 42"
In the following Vala example the string argument of
date.format
inside a string template gets formatted (spaces are added), which shouldn't be the case and makes the URL invalid.test file:
generated result:
expected result: same as test file
version: Uncrustify-0.78.1-104-b18da33ad
The issue was observed in workbenchdev/demos#69
The text was updated successfully, but these errors were encountered: