| Index: pkg/compiler/lib/src/diagnostics/messages.dart
|
| diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
|
| index 830a010ad396a68d44db01c3a90f7fa02f092978..ba2ca1f04316a3caf82cce1314291e82ed826683 100644
|
| --- a/pkg/compiler/lib/src/diagnostics/messages.dart
|
| +++ b/pkg/compiler/lib/src/diagnostics/messages.dart
|
| @@ -1155,35 +1155,30 @@ void main() => new C().m(null);
|
|
|
| MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED: const MessageTemplate(
|
| MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED,
|
| - "Method type variables are not reified.",
|
| - howToFix: "Try using the intended upper bound of the "
|
| - "type variable, or dynamic."
|
| -// TODO(eernst): These examples should be commented in with an `options:`
|
| -// specifying "--generic-method-syntax" and made to work; moreover, the
|
| -// compiler/dart2js test 'generic_method_type_usage' should be transformed to
|
| -// similar examples of the relevant `MessageKind` entries.
|
| -//
|
| -// examples: const [
|
| -// """
|
| -// // Method type variables are not reified, so they cannot be returned.
|
| -// Type f<T>() => T;
|
| -//
|
| -// main() => f<int>();
|
| -// """,
|
| -// """
|
| -// // Method type variables are not reified, so they cannot be tested dynamically.
|
| -// bool f<T>(Object o) => o is T;
|
| -//
|
| -// main() => f<int>(42);
|
| -// """,
|
| -// """
|
| -// // Method type variables are not reified, so they cannot be tested dynamically.
|
| -// bool f<T>(Object o) => o as T;
|
| -//
|
| -// main() => f<int>(42);
|
| -// """
|
| -// ]
|
| - ),
|
| + "Method type variables do not have a runtime value.",
|
| + options: const ["--generic-method-syntax"],
|
| + howToFix: "Try using the upper bound of the type variable, "
|
| + "or refactor the code to avoid needing this runtime value.",
|
| + examples: const [
|
| + """
|
| +// Method type variables are not reified, so they cannot be returned.
|
| +Type f<T>() => T;
|
| +
|
| +main() => f<int>();
|
| +""",
|
| + """
|
| +// Method type variables are not reified, so they cannot be tested dynamically.
|
| +bool f<T>(Object o) => o is T;
|
| +
|
| +main() => f<int>(42);
|
| +""",
|
| + """
|
| +// Method type variables are not reified, so they cannot be tested dynamically.
|
| +bool f<T>(Object o) => o as T;
|
| +
|
| +main() => f<int>(42);
|
| +"""
|
| + ]),
|
|
|
| MessageKind.INVALID_TYPE_VARIABLE_BOUND: const MessageTemplate(
|
| MessageKind.INVALID_TYPE_VARIABLE_BOUND,
|
|
|