Fix abstract class with default constructor crashes compiler#284
Open
khoadng wants to merge 1 commit into
Open
Fix abstract class with default constructor crashes compiler#284khoadng wants to merge 1 commit into
khoadng wants to merge 1 commit into
Conversation
Zverik
reviewed
Mar 22, 2026
Root cause: IdentifierReference.name arrives as 'ClassName.' (trailing
dot) when resolving default super constructors — constructor.dart builds
'${extendsType.name}.$constructorName' where constructorName is empty.
Then _declarationToVariable/_declarationToStaticDispatch appends another
dot via '$name.', producing 'ClassName..' which doesn't match the
registered key 'ClassName.' in topLevelDeclarationPositions.
Fix: extract _resolveDefaultConstructorOffset that normalizes name to
bare class name before building the constructor key, so the key is
always consistently 'ClassName.'.
baee0e4 to
7d54a93
Compare
Contributor
Author
|
Pushed a new approach. I think the root cause is that member keys are raw strings with an implicit dot convention. Code that builds |
Zverik
approved these changes
Mar 24, 2026
Collaborator
|
This looks same but better. Thanks! I've approved it, but will need to wait for Ethan. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extending an abstract class that has no explicit constructor crashed with a null check error in OffsetTracker