by quadcore · 4y ago · 0 comments
a = b ? c["${d}"] : e;
...I think don't compile. You have to write
a = b ? (c["${d}"]) : e;
...for it to compile.
I'm one of the developers of Dart, and I just tried to reproduce your bug. Here's what I tried:
int? f(bool b, Map<String, int> c, int d, int e) {
int? a;
a = b ? c["${d}"] : e;
return a;
}
main() {
print(f(true, {'1': 10}, 1, 20));
print(f(false, {'1': 10}, 1, 20));
}
This program analyzes and runs cleanly for me, with no need for extra parentheses.Can you say more about what you were trying to do when you ran into this bug? Ideally file an issue at https://github.com/dart-lang/sdk/issues/new. (We really do read and respond to them, and if you find a bug in the grammar, there's a good chance I'll be the one to fix it!)
clientTable?["seat${seat}Pot"] += clientTable?["seat${seat}Front"] + (clientTable?["bettingRound"] == 1 ? (clientTable?["seat${seat}Dead"]) : 0);
compiles
clientTable?["seat${seat}Pot"] += clientTable?["seat${seat}Front"] + (clientTable?["bettingRound"] == 1 ? clientTable?["seat${seat}Dead"] : 0);
doesnt
good luck fixing this :)