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

DDC missing correct type check #36158

Closed
vsmenon opened this issue Mar 8, 2019 · 5 comments
Closed

DDC missing correct type check #36158

vsmenon opened this issue Mar 8, 2019 · 5 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures
Milestone

Comments

@vsmenon
Copy link
Member

vsmenon commented Mar 8, 2019

This looks like a nasty regression - the following isn't throwing in DDC (but is in DDK) and is printing false:

void main() {
  List<int> l = [1, 2, 3].where((x) => x.isEven).map((x) => x + 1);
  print(l);
  print(l is List<int>);
}

It was working correctly as recently as 2.2.0-dev.1.1.

@vsmenon
Copy link
Member Author

vsmenon commented Mar 8, 2019

@nshahan - can you take a look? It's possible it's a recent analyzer change giving us the wrong type. The generated code for that example is checking against Iterable<int> not List<int> on the assignment to l.

fyi @jmesserly @stereotype441

@vsmenon vsmenon added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Mar 8, 2019
@nshahan
Copy link
Contributor

nshahan commented Mar 8, 2019

@vsmenon Yes, I'll dig in now.

@vsmenon
Copy link
Member Author

vsmenon commented Mar 8, 2019

Thanks! In reify_coercions.dart, there is a call to ast_properties.getImplicitCast(node) - may want to sanity check what type we're getting there on this example.

@vsmenon vsmenon added this to the Dart2.3 milestone Mar 13, 2019
@vsmenon vsmenon added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. and removed web-dev-compiler labels Mar 13, 2019
@vsmenon
Copy link
Member Author

vsmenon commented Mar 13, 2019

@stereotype441 - as discussed offline, we tracked to a CL by @scheglov . Will you folks be able to fix soon? This is a pretty nasty regression (soundness bug).

fyi - @jmesserly

@jmesserly
Copy link

jmesserly commented Mar 15, 2019

https://dart-review.googlesource.com/c/sdk/+/97143 should fix it.

There may be a related (but distinct) issue in _findCovariantChecksForMember, for finding covariant parameter type checks. I haven't tried to write Dart code that demonstrates it in practice, but the implementation looks problematic.

It's not entirely obvious to me how to fix that one. I think it needs to be modified to use InheritanceManager2 (which has the nice side effect that it should run faster), but I'm not sure if there's a simple way to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

3 participants