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

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1756673002: Instantiate interface types to bounds. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 41d96a582d7ba00c5abe95a328ae0109ac160ee1..f743d4b3ebeff150873059b62f75e5af2b2e49ab 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -14228,6 +14228,33 @@ void main() {
_expectInitializerType('foo', 'Future<String>', isNull);
}
+ void test_implicitBounds() {
+ String code = r'''
+class A<T> {}
+
+class B<T extends num> {}
+
+class C<S extends int, T extends B<S>, U extends B> {}
+
+void test() {
+//
+ A ai;
+ B bi;
+ C ci;
+ var aa = new A();
+ var bb = new B();
+ var cc = new C();
+}
+''';
+ _resolveTestUnit(code);
+ _expectIdentifierType('ai', "A<dynamic>");
+ _expectIdentifierType('bi', "B<num>");
+ _expectIdentifierType('ci', "C<int, B<int>, B<num>>");
+ _expectIdentifierType('aa', "A<dynamic>");
+ _expectIdentifierType('bb', "B<num>");
+ _expectIdentifierType('cc', "C<int, B<int>, B<num>>");
+ }
+
void test_setterWithDynamicTypeIsError() {
Source source = addSource(r'''
class A {
@@ -17087,20 +17114,6 @@ class TypeResolverVisitorTest {
_listener.assertErrorsWithCodes([StaticWarningCode.UNDEFINED_CLASS]);
}
- void test_visitTypeName_prefixed_noParameters_noArguments_undefined() {
- SimpleIdentifier prefix = AstFactory.identifier3("unknownPrefix")
- ..staticElement = new _StaleElement();
- SimpleIdentifier suffix = AstFactory.identifier3("unknownSuffix")
- ..staticElement = new _StaleElement();
- TypeName typeName =
- new TypeName(AstFactory.identifier(prefix, suffix), null);
- _resolveNode(typeName, []);
- expect(typeName.type, UndefinedTypeImpl.instance);
- expect(prefix.staticElement, null);
- expect(suffix.staticElement, null);
- _listener.assertErrorsWithCodes([StaticWarningCode.UNDEFINED_CLASS]);
- }
-
void test_visitTypeName_parameters_arguments() {
ClassElement classA = ElementFactory.classElement2("A", ["E"]);
ClassElement classB = ElementFactory.classElement2("B");
@@ -17129,6 +17142,20 @@ class TypeResolverVisitorTest {
_listener.assertNoErrors();
}
+ void test_visitTypeName_prefixed_noParameters_noArguments_undefined() {
+ SimpleIdentifier prefix = AstFactory.identifier3("unknownPrefix")
+ ..staticElement = new _StaleElement();
+ SimpleIdentifier suffix = AstFactory.identifier3("unknownSuffix")
+ ..staticElement = new _StaleElement();
+ TypeName typeName =
+ new TypeName(AstFactory.identifier(prefix, suffix), null);
+ _resolveNode(typeName, []);
+ expect(typeName.type, UndefinedTypeImpl.instance);
+ expect(prefix.staticElement, null);
+ expect(suffix.staticElement, null);
+ _listener.assertErrorsWithCodes([StaticWarningCode.UNDEFINED_CLASS]);
+ }
+
void test_visitTypeName_void() {
ClassElement classA = ElementFactory.classElement2("A");
TypeName typeName = AstFactory.typeName4("void");
@@ -17269,10 +17296,10 @@ class _StaleElement extends ElementImpl {
_StaleElement() : super("_StaleElement", -1);
@override
- accept(_) => throw "_StaleElement shouldn't be visited";
+ get kind => throw "_StaleElement's kind shouldn't be accessed";
@override
- get kind => throw "_StaleElement's kind shouldn't be accessed";
+ accept(_) => throw "_StaleElement shouldn't be visited";
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698