Closed
Description
Flutter users reporting bizarre errors from the compiler that confusingly appear and disappear (might be related to serialized incremental compiler state?)
Compiler message:
lib/main.dart:73:35: Error: The argument type 'dart.core::String' can't be assigned to the parameter type 'dart.core::String'.
Try changing the type of the parameter, or casting the argument to 'dart.core::String'.
image: new AssetImage('s'),
I don't have a concrete reproduction for it - but I asked users that face it to send us their Dart source if possible.
I saw some reports that users resolved it by changing import scheme from relative to package-scheme imports
Any ideas what can be causing this @peter-ahe-google @kmillikin @jensjoha ? Maybe a bug in class hierarchy?
Maybe we could add some debugging information to CFE to dump more debugging information for this sort of error?
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
zoechi commentedon Jan 20, 2019
After #33076 was fixed I have only seen this mentioned on Windows where upper-case wasn't used consistently when importing the same file.
@DanTup encountered this case a few times AFAIK with users.
DanTup commentedon Jan 20, 2019
I've seen errors like this a few different ways (though all at analysis time):
I don't know if any of those are related to this, but maybe it helps. The error could definitely be improved for some of those cases (eg. where the strings are identical, or even when they differ only by case).
lrhn commentedon Jan 21, 2019
The import-case issue explains other classes, but not
String
fromdart:core
. You cannot importdart:core
with a different case. There must be something more fundamentally wrong if you have two versions ofdart:core
in your program.peter-ahe-google commentedon Jan 21, 2019
We are exploring a few ideas for how this situation could arise.
peter-ahe-google commentedon Jan 21, 2019
We have a reproduction. More details will follow.
jensjoha commentedon Jan 28, 2019
As @peter-ahe-google said we reproduced this.
We cannot say for sure this is the only way to do it, but it's at least the only way we can think of to reproduce it:
IncrementalCompiler.fromComponent
- so probably something happening as a consequence of a hot-reload failure.Reproduction landing in CL (https://dart-review.googlesource.com/c/sdk/+/91228) soon.
This method (
fromComponent
) was written by and is used by the VM team and they should probably fix it. Either by not doing it at all (and instead serializing and loading from dill instead) or by somehow setting the incremental compiler up in such a way that duplicate data isn't read in.peter-ahe-google commentedon Jan 28, 2019
@aam let me know if you need to discuss this in detail. I think it may be a simple fix: Make sure that
CompilerOptions.sdkSummary
is null as well asCompilerOptions.inputSummaries
andCompilerOptions.linkedDependencies
are both empty when usingIncrementalCompiler.fromComponent
.aam commentedon Jan 28, 2019
Thanka @peter-ahe-google . I will take a look.
aam commentedon Feb 4, 2019
It seems that we need to ensure that saved last known good state includes platform libraries, which doesn't currently - when we rebuild incremental compiler we reload platform libraries so references from saved state don't match to what is loaded for new incremental compiler.
@jensjoha @peter-ahe-google can you please take a look at concept https://dart-review.googlesource.com/c/sdk/+/91859 which basically adds list of platform libraries that incremental compiler can stash and use when reject has to rebuild compiler.
a-siva commentedon Feb 19, 2019
is this issue resolved?
aam commentedon Feb 19, 2019
No, this is work in progress as this tracks proper implementation of vm
reject
request.There are changes that @jensjoha implementing that will make fasta incremental compiler respect
--omit-platform
flag, then vm incremental compiler will be requesting incremental components with platform libraries, filter them out(based ondart:
scheme) and add them to incremental component whenreject
request has to be processed.jensjoha commentedon Feb 25, 2019
Should have been fixed by 2087d6d.