Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: tests/compiler/dart2js/type_variable_bound_test.dart

Issue 1182663008: Typecheck const classes in the context of the constructor call. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/type_variable_bound_test.dart
diff --git a/tests/compiler/dart2js/type_variable_bound_test.dart b/tests/compiler/dart2js/type_variable_bound_test.dart
index 6844abba0fdbc4bbf24f606147b36d5347863b97..6ba982cef376923a357da615e9247b0506d5371e 100644
--- a/tests/compiler/dart2js/type_variable_bound_test.dart
+++ b/tests/compiler/dart2js/type_variable_bound_test.dart
@@ -9,7 +9,7 @@ import "package:expect/expect.dart";
Future compile(String source) {
Uri uri = Uri.parse('test:code');
- var compiler = compilerFor(source, uri, analyzeOnly: true);
+ var compiler = compilerFor(source, uri, analyzeOnly: true, enableTypeAssertions: true);
Johnni Winther 2015/06/17 06:56:29 Long line.
Harry Terkelsen 2015/08/10 23:49:34 Done.
compiler.diagnosticHandler = createHandler(compiler, source);
return compiler.runCompiler(uri).then((_) {
return compiler;
@@ -214,6 +214,39 @@ void main() {
MessageKind.INVALID_TYPE_VARIABLE_BOUND]);
}
+test10() {
+ test(r"""
+class A {
+ const A();
+}
+class Test<T extends A> {
+ final T x = const A();
+ const Test();
+}
+main() {
+ print(const Test<A>());
+}
+""");
+}
+
+test11() {
+ test(r"""
+class A {
+ const A();
+}
+class B extends A {
+ const B();
+}
+class Test<T extends A> {
+ final T x = const A();
Siggi Cherem (dart-lang) 2015/06/16 18:19:06 mmm... we got a tricky situation here on how to re
Harry Terkelsen 2015/08/10 23:49:35 I agree, but I added a TODO rather than implement
+ const Test();
+}
+main() {
+ print(const Test<B>());
+}
+""", errors: [MessageKind.NOT_ASSIGNABLE, MessageKind.NOT_ASSIGNABLE]);
Siggi Cherem (dart-lang) 2015/06/16 18:19:06 not sure if it's worth it, but maybe we can add so
+}
+
main() {
test1();
test2();
@@ -224,4 +257,6 @@ main() {
test7();
test8();
test9();
+ test10();
+ test11();
}

Powered by Google App Engine
This is Rietveld 408576698