Fix #24824 FunProtoTyped preservation in wildApprox and map to avoid compiler crash#25662
Open
dancewithheart wants to merge 3 commits intoscala:mainfrom
Open
Fix #24824 FunProtoTyped preservation in wildApprox and map to avoid compiler crash#25662dancewithheart wants to merge 3 commits intoscala:mainfrom
dancewithheart wants to merge 3 commits intoscala:mainfrom
Conversation
3b29672 to
c04821f
Compare
Signed-off-by: Piotr Paradzinski <dancingwithopenheart@gmail.com>
c04821f to
34369d5
Compare
Contributor
Author
|
Hi @Alex1005a, I would like to give you credit - your work on FunProtoTyped handling was very insightful. I arrived at a similar direction after many failed experiments, and in the end I used your changes - kudos 🥇 for this 🙂 I cherry-picked these commits: and used them in my PR. I’m planning to move the PR from draft to ready for review so it can hopefully be merged - if that’s OK with you 🙂 |
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.
Fixes #24824: preserve
FunProtoTypedinwildApproxandFunProtoTyped.mapto avoid assert fromcollectPartsthat leading to a crashHow much have you relied on LLM-based tools in this contribution?
moderately: I feed LLM with relevant issues, PRs; reiterated over proposed solutions,
then switched to work done by @Alex1005a as he had more mature solution
How was the solution tested?
Tested locally added reproduction case:
sbt --client "testCompilation 24824"and nearby cases (that failed during earlier iterations):
Not all tests are passing locally:
sbt --error "testOnly dotty.tools.dotc.CompilationTests"but errors seems to be environment-related (e.g. subprocess interruptions or JDK-related issues).
I hope CI will clarify this.
Additional notes
My first attempt was to restrict when assert in collectParts is triggered
scala3/compiler/src/dotty/tools/dotc/typer/Implicits.scala
Lines 684 to 685 in 7c54aad
by:
It worked for repro sample.
Similar approach was proposed @andrzejressel in #17305 (comment).
Following review remark oh his PR: #17471 (comment) I was investigating why we end up in collectparts in assert.
I tried modifying other parts of
wildApproxand related pattern matches,without luck.
From debugging (it can change the behavior of compiler!) it looked like issue is not in a match cases,
but in how
FunProtoTypedis handled in error-recovery paths, wherewildApproxreconstructs protos.Preserving
FunProtoTypedavoids breaking invariants about already-typed arguments.Since the same code was changed #23020 I switched to extract changes around FunProtoTyped as Alex1005a proposed in #23020#issuecomment-3993039055 to check if it works.