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

Unified Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 2001093006: Changes dart2js to warn at reified usage of method type variables. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/members.dart
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index a69b35950f82b7543c57db1a381905fd582867f6..a382b7510bc540a71a507c5b220adec4bd9988cb 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -1121,6 +1121,14 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
type = resolveTypeAnnotation(typeNode);
sendStructure = new IsStructure(type);
}
+
+ // GENERIC_METHODS: Method type variables are not reified so we must warn
+ // about the error which will occur at runtime.
+ if (type is MethodTypeVariableType) {
+ reporter.reportWarningMessage(
+ node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED);
+ }
+
registry.registerTypeUse(new TypeUse.isCheck(type));
registry.registerSendStructure(node, sendStructure);
return const NoneResult();
@@ -1133,6 +1141,14 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
Node typeNode = node.arguments.head;
DartType type = resolveTypeAnnotation(typeNode);
+
+ // GENERIC_METHODS: Method type variables are not reified so we must warn
+ // about the error which will occur at runtime.
+ if (type is MethodTypeVariableType) {
+ reporter.reportWarningMessage(
+ node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED);
+ }
+
registry.registerTypeUse(new TypeUse.asCast(type));
registry.registerSendStructure(node, new AsStructure(type));
return const NoneResult();
@@ -1888,6 +1904,12 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
// TODO(johnniwinther): Clean up registration of elements and selectors
// for this case.
} else {
+ // GENERIC_METHODS: Method type variables are not reified so we must warn
+ // about the error which will occur at runtime.
+ if (element.type is MethodTypeVariableType) {
+ reporter.reportWarningMessage(
+ node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED);
+ }
semantics = new StaticAccess.typeParameterTypeLiteral(element);
}
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698