Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

task model: not correctly checking (inferring?) initializing formals #346

Closed
jmesserly opened this issue Sep 24, 2015 · 5 comments
Closed

Comments

@jmesserly
Copy link
Contributor

This test is failing:

00:03 +53 -5: inferred initializing formal checks default value
  expected error was not reported at:

  severe: line 3, column 49 of /main.dart: StaticTypeError
          Foo([this.x = /*severe:StaticTypeError*/"1"]);
                                                  ^^^
@jmesserly
Copy link
Contributor Author

I believe this also affects 'Constructors' in checker_test.dart

@jmesserly jmesserly changed the title task model not correctly checking (inferring?) initializing formals task model: not correctly checking (inferring?) initializing formals Sep 25, 2015
@jmesserly
Copy link
Contributor Author

the "Constructors" test is now passing with @leafpetersen 's CL https://codereview.chromium.org/1370793002/

@jmesserly
Copy link
Contributor Author

the other one seems to be failing still

@jmesserly
Copy link
Contributor Author

Ah, here's what our old code had to say:

  @override
  visitFieldFormalParameter(FieldFormalParameter node) {
    // Ensure the field formal parameter's type is updated after inference.
    // Normally this happens during TypeResolver, but that's before we've done
    // inference on the field type.
    var element = node.element;
    if (element is FieldFormalParameterElement) {
      if (element.type.isDynamic) {
        // In malformed code, there may be no actual field.
        if (element.field != null) {
          element.type = element.field.type;
        }
      }
    }
    super.visitFieldFormalParameter(node);
  }

I wonder if we have the same issue ... that we're inferring after the type has been computed.

@jmesserly
Copy link
Contributor Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant