-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instantiate Type Vars in completion labels of extension methods (#18914)
This PR fixes the completion labels for extension methods and old style completion methods. It required an API change of `Completion.scala` as it didn't contain enough information to properly create labels on presentation compiler side. Along with this following parts were rewritten to avoid recomputation: - computation of adjustedPath which is necessary for extension construct completions, - computation of prefix is now unified across the metals and presentation compilers, - completionKind was changed, and kind Scope, Member are now part of completion mode. The biggest change is basically added support for old style extension methods. I found out that the type var was not instantiated after `ImplicitSearch` computation, and was only calculated at later stages. I don't have enough knowledge about Inference and Typer to know whether this is a bug or rather an intended behaviour but I managed to solve it without touching the typer: ```scala def tryToInstantiateTypeVars(conversionTarget: SearchSuccess): Type = try val typingCtx = ctx.fresh inContext(typingCtx): val methodRefTree = ref(conversionTarget.ref, needLoad = false) val convertedTree = ctx.typer.typedAheadExpr(untpd.Apply(untpd.TypedSplice(methodRefTree), untpd.TypedSplice(qual) :: Nil)) Inferencing.fullyDefinedType(convertedTree.tpe, "", pos) catch case error => conversionTarget.tree.tpe // fallback to not fully defined type ``` [Cherry-picked 95266f2]
- Loading branch information
1 parent
26006ce
commit 43003c7
Showing
20 changed files
with
525 additions
and
375 deletions.
There are no files selected for viewing
This file contains 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
272 changes: 159 additions & 113 deletions
272
compiler/src/dotty/tools/dotc/interactive/Completion.scala
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.