Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPA type inference infers dynamic for (expression == null) and (null == expression) #16825

Closed
polux opened this issue Feb 14, 2014 · 1 comment
Assignees
Labels
P3 A lower priority bug or feature request web-dart2js

Comments

@polux
Copy link
Contributor

polux commented Feb 14, 2014

For expression of the form (expression == null) and (null == expression), the CPA type inference infers null instead of bool for =='s selector.

Reason: SimpleTypeInferrerVisitor.visitDynamicSend never calls handleDynamicSend when one of the two arguments of == is the literal 'null'. Because of that, getSendReturnType is never called and I never call augmentInferredSelectorType.

Example where it leads to wrong output:

class A {
  operator ==(x) => "a";
}

main() {
  new A() == 1;
  1 == null;
}

Inferred selector type for default inference is Union of [[exact=JSString], [exact=JSBool]]
Inferred selector type for CPA inference is [exact=JSString]
Intersection is [exact=JSString]

@polux polux added Type-Defect P3 A lower priority bug or feature request web-dart2js labels Feb 14, 2014
@polux polux self-assigned this Feb 14, 2014
@rakudrama
Copy link
Member

Obsolete; we removed CPA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 A lower priority bug or feature request web-dart2js
Projects
None yet
Development

No branches or pull requests

2 participants