-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Analyzer instantiate to bounds for typedefs is inconsistent #32114
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
Comments
Looks like the common front end handles this situation correctly:
|
👍 |
@devoncarew Not sure what milestone to call this, but this may be a blocker for cleaning up internal code. |
@scheglov @bwilkerson Any thoughts on how much work this would be to fix? The impact on internal code isn't huge, but the spurious errors are very perplexing. If necessary I can probably fix up internal code to work around this, but it's not great. |
No, sorry. I'll try to dig into it a bit tomorrow. |
Just to keep you updated... I'm not very familiar with the type system anymore, so it's being quite a challenge to figure this out, but I think that at least part of the problem is the use of For example, two of the uses are in However, when I replace all uses with either |
One possible clue is that I believe that the Driver path implements this correctly (or more correctly). In checker_test.dart, the test test_fuzzyArrowLegacyAssignability_GlobalInference() passes with the driver, but not otherwise. If you pare down that test, you might be able to isolate what the driver is doing, which might tell you what the other code paths should be doing? |
@scheglov Any ideas about what might be different between Driver and task model for this case? |
So far I found that we perform |
I would have guessed that explicit types would have already been instantiated to bounds before the summary is generated. Is that not the case? In any case, I think that linking summaries is something we do in the driver case (where types are being computed correctly), but not in the task model, so a bug in summary linking wouldn't explain the problem we're seeing in the task model. Right? |
Hm...
Well, I does not look that even driver case is correct - |
It looks like we would need to fix both the Driver and the task model implementations, and it seems likely that doing so would require two independent fixes. Given that, and our current lack of understanding of where and how this needs to happen, I suspect that we're looking at a fairly significant effort to try to fix it. If I had to guess (which is all it would be given my lack of familiarity with this code) I'd probably estimate a full week. |
I'm not sure whether or not this needs to be fixed in the task model given other conversations, but I'm worried about not fixing it in the driver given our current plans to keep this around for multiple quarters. It's hard to know without knowing scope, but the symptoms of this bug are really inexplicable to users. |
cc @srawlins who hit this internally. |
[email protected] Bug: #32114 Change-Id: I215eafb6314fe265d4809ff6ed80e4a567365a4f Reviewed-on: https://dart-review.googlesource.com/46381 Reviewed-by: Brian Wilkerson <[email protected]>
It looks like we're still hitting this. I'm seeing it internally in the presence of summaries and exports. If I compile the below file by file (i.e., 3 build steps), I get:
Since's override3.dart:
override2.dart:
override.dart:
|
@bwilkerson @scheglov - i'm hitting this internally while fixing runtime type errors in user code. |
Wasn't able to repro this via unit test:
Will have to dig a bit deeper here. |
Also could not repro using bazel, reached out to @vsmenon over email on tips to repro |
Do the repro instructions here: #32114 (comment) not work any more? |
Its likely I'm not "compiling it file by file" the same way. But I tried two means already and neither worked |
You can reproduce as follows:
|
Thanks Leaf! I am not familiar enough with ddc apparently. I suspect this is a task model only bug, and that we won't need to fix, since I can't repro it with tools that are on the driver model. I will confirm that. |
I thought that summaries were not driven by the task model, and that seems to be the key bit here? |
Any updates on this? |
any updates on this? |
I have 4 test failures on a solution to this which I'm working through. It's a small number but don't read too much into that -- my last solution to those 4 failures introduced ~80 new ones :) I rolled that back and I'm trying a different approach, but it might have been the right one and I may end up going back through that path. |
Looks like those four failures were do to me being overly defensive in my code. Now I'm just trying to get a clean repro in a unit test, not only to make the CL clean + future proof it, but also to be able to have test coverage around the changes I'm making. It doesn't seem to want to be exposed via unit test. Currently mucking around in the debugger to see why I can't get it down the pathway that is fairly obviously wrong once it gets there. |
Woohoo thanks @MichaelRFairhurst this was a doozy! |
The following program shows that the analyzer is mostly (but not entirely) not doing instantiate to bounds on typedefs. The assignments in the body of main cause errors which print out the types and show that the inferred type of
globalInferred
is correctly instantiated to bounds, but the annotated type onglobal
is not. Most other uses of typedefs don't seem to be instantiated to bounds.This is mostly being hidden right now since fuzzy arrows will allow the assignment to exist as an implicit downcast. If I disable fuzzy arrows, then the assignment of
global
toglobalInferred
gives a type error!I can work around this in the short term, but this is fairly high priority since it will block us from turning off fuzzy arrows entirely, and is also probably causing some spurious fuzzy arrow warnings.
cc @stereotype441 @scheglov @devoncarew
cc @stefantsov to verify that the front end is doing the right thing here
cc @srawlins
The text was updated successfully, but these errors were encountered: