| Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
|
| index b4048bdb8d3444d0286096947a2b3b11c9ad54e8..109e3df07d4b57b78d3722a7517baba0a9f81472 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
|
| @@ -2176,9 +2176,25 @@ class SsaBuilder extends ResolvedVisitor {
|
| return;
|
| }
|
| }
|
| - HInstruction newParameter = potentiallyCheckType(
|
| - localsHandler.directLocals[parameterElement],
|
| - parameterElement.type);
|
| + HInstruction newParameter =
|
| + localsHandler.directLocals[parameterElement];
|
| + if (!element.isConstructor ||
|
| + !(element as ConstructorElement).isRedirectingFactory) {
|
| + // Redirection factories must not check their argument types.
|
| + // Example:
|
| + //
|
| + // class A {
|
| + // A(String foo) = A.b;
|
| + // A(int foo) { print(foo); }
|
| + // }
|
| + // main() {
|
| + // new A(499); // valid even in checked mode.
|
| + // new A("foo"); // invalid in checked mode.
|
| + //
|
| + // Only the final target is allowed to check for the argument types.
|
| + newParameter =
|
| + potentiallyCheckType(newParameter, parameterElement.type);
|
| + }
|
| localsHandler.directLocals[parameterElement] = newParameter;
|
| });
|
|
|
|
|