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

Unified Diff: pkg/front_end/test/fasta/type_inference/type_schema_test.dart

Issue 2856383003: Begin implementing subtype matching for type inference. (Closed)
Patch Set: Change test library URI Created 3 years, 7 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: pkg/front_end/test/fasta/type_inference/type_schema_test.dart
diff --git a/pkg/front_end/test/fasta/type_inference/type_schema_test.dart b/pkg/front_end/test/fasta/type_inference/type_schema_test.dart
index 416e17bc55df9b6f05acccbb7f8b9b81daaad392..61dc327cd913223c8194add054dd2b08a87bf45c 100644
--- a/pkg/front_end/test/fasta/type_inference/type_schema_test.dart
+++ b/pkg/front_end/test/fasta/type_inference/type_schema_test.dart
@@ -26,6 +26,32 @@ class UnknownTypeTest {
expect(unknownType, isNot(equals(const DynamicType())));
}
+ void test_isKnown() {
+ expect(isKnown(unknownType), isFalse);
+ expect(isKnown(const DynamicType()), isTrue);
+ var classA = new Class(name: 'A');
+ var A = new InterfaceType(classA);
+ var typedefF = new Typedef('F', A);
+ expect(isKnown(A), isTrue);
+ expect(isKnown(new InterfaceType(classA, [A])), isTrue);
+ expect(isKnown(new InterfaceType(classA, [unknownType])), isFalse);
+ expect(isKnown(new FunctionType([], const VoidType())), isTrue);
+ expect(isKnown(new FunctionType([], unknownType)), isFalse);
+ expect(isKnown(new FunctionType([A], const VoidType())), isTrue);
+ expect(isKnown(new FunctionType([unknownType], const VoidType())), isFalse);
+ expect(
+ isKnown(new FunctionType([], const VoidType(),
+ namedParameters: [new NamedType('x', A)])),
+ isTrue);
+ expect(
+ isKnown(new FunctionType([], const VoidType(),
+ namedParameters: [new NamedType('x', unknownType)])),
+ isFalse);
+ expect(isKnown(new TypedefType(typedefF)), isTrue);
+ expect(isKnown(new TypedefType(typedefF, [A])), isTrue);
+ expect(isKnown(new TypedefType(typedefF, [unknownType])), isFalse);
+ }
+
void test_ordinary_visitor_noOverrides() {
expect(unknownType.accept(new _OrdinaryVisitor()), isNull);
}

Powered by Google App Engine
This is Rietveld 408576698