From 02b2e6c23f0825ed2139ce7931abfe7d3046f0e7 Mon Sep 17 00:00:00 2001 From: Erik Ernst Date: Wed, 8 Sep 2021 06:51:34 +0000 Subject: [PATCH] Adjust explicit_instantiation_syntax_test This test used `..` as a continuationToken (that is, it did not expect a syntax error for `g(C .. toString())`). This CL changes the test to expect that to be a syntax error, and also eliminates the static warning caused by using `?.` on a receiver with a known non-null value (that's not relevant to the topic of this test, I just didn't avoid it when the tests were written). Change-Id: I275de6423710c3a598bedd2f54f4e9e7463a6d04 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212587 Auto-Submit: Erik Ernst Commit-Queue: Jens Johansen Reviewed-by: Jens Johansen --- .../explicit_instantiation_syntax_test.dart | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/language/constructor/explicit_instantiation_syntax_test.dart b/tests/language/constructor/explicit_instantiation_syntax_test.dart index 3b3ddd3b92f..387da72a7c3 100644 --- a/tests/language/constructor/explicit_instantiation_syntax_test.dart +++ b/tests/language/constructor/explicit_instantiation_syntax_test.dart @@ -42,6 +42,7 @@ void g(_) {} void h(_1, [_2]) {} int i = 0; +bool boolVar = true; class Test { var x; @@ -108,16 +109,17 @@ class Test { g(C . named()); - g(C .. toString()); + h(C .. toString()); //# 13: syntax error + g((C) .. toString()); - h(C ...); //# 13: syntax error + h(C ...); //# 14: syntax error - h(C ...?); //# 14: syntax error + h(C ...?); //# 15: syntax error - h(C / 1); //# 15: syntax error + h(C / 1); //# 16: syntax error g((C) / 1); - g(C /**/); //# 16: ok + g(C /**/); //# 17: ok f(C /**/ - 1); g(C // @@ -126,38 +128,38 @@ class Test { - 1); - h(C /= 1); //# 17: syntax error + h(C /= 1); //# 18: syntax error g({C : 1}); - C ; //# 18: ok + C ; //# 19: ok - h(C < 1); //# 19: syntax error + h(C < 1); //# 20: syntax error g((C) < 1); - h(C << 1); //# 20: syntax error + h(C << 1); //# 21: syntax error g((C) << 1); - h(C <<= 1); //# 21: syntax error + h(C <<= 1); //# 22: syntax error - h(C <= 1); //# 22: syntax error + h(C <= 1); //# 23: syntax error g((C) <= 1); - h(C = 1); //# 23: syntax error + h(C = 1); //# 24: syntax error g(C == 1); - h(C =>); //# 24: syntax error + h(C =>); //# 25: syntax error // The operator `>>` is a single token in the grammar. - h(C > 1); //# 25: syntax error + h(C > 1); //# 26: syntax error h((C) > 1); - h(true + C ? 1 : 1); //# 26: syntax error + h(true + C ? 1 : 1); //# 27: syntax error g(true + (C) ? 1 : 1); - g(C ?. toString()); //# 27: syntax error - g((C) ?. toString()); //# 28: static type warning + g(C ?. toString()); //# 28: syntax error + g((boolVar ? null : C) ?. toString()); h(C ?.. toString()); //# 29: syntax error