diff --git a/presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala b/presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala index e86732c3453d..bf814ef682e0 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala @@ -13,7 +13,7 @@ import dotty.tools.dotc.core.Names.* import dotty.tools.dotc.core.Symbols.* import dotty.tools.dotc.util.SourcePosition import dotty.tools.dotc.util.Spans -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/AutoImportsProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/AutoImportsProvider.scala index 8546bbf62384..ded7845ffa4e 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/AutoImportsProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/AutoImportsProvider.scala @@ -15,7 +15,7 @@ import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourceFile import dotty.tools.pc.AutoImports.* import dotty.tools.pc.completions.CompletionPos -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala b/presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala index c962617ac7fb..291ffe1fec30 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala @@ -9,7 +9,7 @@ import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.Flags.* import dotty.tools.dotc.core.Symbols.* import dotty.tools.dotc.core.Types.TermRef -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j.CompletionItem @@ -62,7 +62,7 @@ object CompletionItemResolver extends ItemResolver: if companion == NoSymbol || gsym.is(JavaDefined) then if gsymDoc.isEmpty() then if gsym.isAliasType then - fullDocstring(gsym.info.metalsDealias.typeSymbol, search) + fullDocstring(gsym.info.deepDealias.typeSymbol, search) else if gsym.is(Method) then gsym.info.finalResultType match case tr @ TermRef(_, sym) => diff --git a/presentation-compiler/src/main/dotty/tools/pc/ConvertToNamedArgumentsProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/ConvertToNamedArgumentsProvider.scala index 00bfe17cb21b..d4f945760cc0 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/ConvertToNamedArgumentsProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/ConvertToNamedArgumentsProvider.scala @@ -12,7 +12,7 @@ import dotty.tools.dotc.core.Types.MethodType import dotty.tools.dotc.interactive.Interactive import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourceFile -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/ExtractMethodProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/ExtractMethodProvider.scala index 55c4e4d9e4b6..4416d0c0d000 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/ExtractMethodProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/ExtractMethodProvider.scala @@ -23,7 +23,7 @@ import dotty.tools.dotc.util.SourceFile import dotty.tools.dotc.util.SourcePosition import dotty.tools.pc.printer.ShortenedTypePrinter import dotty.tools.pc.printer.ShortenedTypePrinter.IncludeDefaultParam -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j.TextEdit import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala index 6f39b4871a06..c0f2d49d341e 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala @@ -23,7 +23,7 @@ import dotty.tools.dotc.util.SourceFile import dotty.tools.dotc.util.SourcePosition import dotty.tools.pc.printer.ShortenedTypePrinter import dotty.tools.pc.printer.ShortenedTypePrinter.IncludeDefaultParam -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* object HoverProvider: @@ -106,7 +106,7 @@ object HoverProvider: if symbol.name == nme.selectDynamic || symbol.name == nme.applyDynamic => fallbackToDynamics(path, printer) case symbolTpes @ ((symbol, tpe) :: _) => - val exprTpw = tpe.widenTermRefExpr.metalsDealias + val exprTpw = tpe.widenTermRefExpr.deepDealias val hoverString = tpw match // https://github.com/scala/scala3/issues/8891 @@ -121,7 +121,7 @@ object HoverProvider: if tpe != NoType then tpe else tpw - printer.hoverSymbol(sym, finalTpe) + printer.hoverSymbol(sym, finalTpe.deepDealias) end match end hoverString @@ -185,9 +185,9 @@ object HoverProvider: findRefinement(parent) case _ => None - val refTpe = sel.typeOpt.widen.metalsDealias match + val refTpe = sel.typeOpt.widen.deepDealias match case r: RefinedType => Some(r) - case t: (TermRef | TypeProxy) => Some(t.termSymbol.info.metalsDealias) + case t: (TermRef | TypeProxy) => Some(t.termSymbol.info.deepDealias) case _ => None refTpe.flatMap(findRefinement).asJava diff --git a/presentation-compiler/src/main/dotty/tools/pc/IndexedContext.scala b/presentation-compiler/src/main/dotty/tools/pc/IndexedContext.scala index ad6fe9420a81..6b74e3aa2ec1 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/IndexedContext.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/IndexedContext.scala @@ -13,7 +13,7 @@ import dotty.tools.dotc.core.Types.* import dotty.tools.dotc.interactive.Interactive import dotty.tools.dotc.typer.ImportInfo import dotty.tools.pc.IndexedContext.Result -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* sealed trait IndexedContext: given ctx: Context @@ -75,7 +75,7 @@ sealed trait IndexedContext: ) private def isTypeAliasOf(alias: Symbol, queriedSym: Symbol): Boolean = - alias.isAliasType && alias.info.metalsDealias.typeSymbol == queriedSym + alias.isAliasType && alias.info.deepDealias.typeSymbol == queriedSym final def isEmpty: Boolean = this match case IndexedContext.Empty => true diff --git a/presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala index b37b1b6dff6c..d8cdbcd8fe69 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala @@ -24,7 +24,7 @@ import dotty.tools.dotc.util.Spans import dotty.tools.dotc.util.Spans.Span import dotty.tools.pc.printer.ShortenedTypePrinter import dotty.tools.pc.printer.ShortenedTypePrinter.IncludeDefaultParam -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j.TextEdit import org.eclipse.lsp4j as l @@ -101,7 +101,7 @@ final class InferredTypeProvider( case _ => true if isInScope(tpe) then tpe - else tpe.metalsDealias + else tpe.deepDealias val printer = ShortenedTypePrinter( symbolSearch, diff --git a/presentation-compiler/src/main/dotty/tools/pc/MetalsInteractive.scala b/presentation-compiler/src/main/dotty/tools/pc/MetalsInteractive.scala index 648c59725742..9a541ef69942 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/MetalsInteractive.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/MetalsInteractive.scala @@ -240,7 +240,7 @@ object MetalsInteractive: end match end enclosingSymbolsWithExpressionType - import dotty.tools.pc.utils.MtagsEnrichments.* + import dotty.tools.pc.utils.InteractiveEnrichments.* private def recoverError( tree: Tree, diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcCollector.scala b/presentation-compiler/src/main/dotty/tools/pc/PcCollector.scala index 60def237badb..c447123c8725 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcCollector.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcCollector.scala @@ -26,7 +26,7 @@ import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourceFile import dotty.tools.dotc.util.SourcePosition import dotty.tools.dotc.util.Spans.Span -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* abstract class PcCollector[T]( driver: InteractiveDriver, diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala index 0de81ec39711..0d4100329c17 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala @@ -19,7 +19,7 @@ import dotty.tools.dotc.interactive.Interactive import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourceFile import dotty.tools.dotc.util.SourcePosition -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j.Location diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcDocumentHighlightProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/PcDocumentHighlightProvider.scala index cd4f4919b1ef..d9b94ebb82a3 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcDocumentHighlightProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcDocumentHighlightProvider.scala @@ -6,7 +6,7 @@ import dotty.tools.dotc.ast.tpd.* import dotty.tools.dotc.core.Symbols.* import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourcePosition -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j.DocumentHighlight import org.eclipse.lsp4j.DocumentHighlightKind diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala index 6d634f56363c..70aaa82eae05 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala @@ -4,7 +4,7 @@ package dotty.tools.pc import java.nio.file.Paths import scala.meta.internal.metals.ReportContext -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import dotty.tools.pc.printer.ShortenedTypePrinter import scala.meta.internal.pc.InlayHints import scala.meta.internal.pc.LabelPart @@ -139,7 +139,7 @@ class PcInlayHintsProvider( isInScope(tycon) && args.forall(isInScope) case _ => true if isInScope(tpe) then tpe - else tpe.metalsDealias(using indexedCtx.ctx) + else tpe.deepDealias(using indexedCtx.ctx) val dealiased = optDealias(tpe) val tpeStr = printer.tpe(dealiased) diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProviderImpl.scala b/presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProviderImpl.scala index 39365475a075..38b5e8d0069b 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProviderImpl.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProviderImpl.scala @@ -17,7 +17,7 @@ import dotty.tools.dotc.core.Symbols.Symbol import dotty.tools.dotc.interactive.Interactive import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourcePosition -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcRenameProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/PcRenameProvider.scala index 8a441e1e385a..94482767f917 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcRenameProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcRenameProvider.scala @@ -8,7 +8,7 @@ import dotty.tools.dotc.core.Flags.* import dotty.tools.dotc.core.Symbols.Symbol import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourcePosition -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcSemanticTokensProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/PcSemanticTokensProvider.scala index f1a0b6a65aa7..a5332f1e4ff6 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcSemanticTokensProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcSemanticTokensProvider.scala @@ -12,7 +12,7 @@ import dotty.tools.dotc.core.Symbols.NoSymbol import dotty.tools.dotc.core.Symbols.Symbol import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourcePosition -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j.SemanticTokenModifiers import org.eclipse.lsp4j.SemanticTokenTypes diff --git a/presentation-compiler/src/main/dotty/tools/pc/SelectionRangeProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/SelectionRangeProvider.scala index 9dce37028bea..7973f4103ff6 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/SelectionRangeProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/SelectionRangeProvider.scala @@ -12,7 +12,7 @@ import dotty.tools.dotc.interactive.Interactive import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourceFile import dotty.tools.dotc.util.SourcePosition -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j import org.eclipse.lsp4j.SelectionRange diff --git a/presentation-compiler/src/main/dotty/tools/pc/SemanticdbSymbols.scala b/presentation-compiler/src/main/dotty/tools/pc/SemanticdbSymbols.scala index d298a88fc655..9ef19587948e 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/SemanticdbSymbols.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/SemanticdbSymbols.scala @@ -7,7 +7,7 @@ import dotty.tools.dotc.core.Flags.* import dotty.tools.dotc.core.Names.* import dotty.tools.dotc.core.Symbols.* import dotty.tools.dotc.semanticdb.* -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* object SemanticdbSymbols: diff --git a/presentation-compiler/src/main/dotty/tools/pc/SignatureHelpProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/SignatureHelpProvider.scala index 80317185458b..edfd9c95fa84 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/SignatureHelpProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/SignatureHelpProvider.scala @@ -10,7 +10,7 @@ import dotty.tools.dotc.util.Signatures import dotty.tools.dotc.util.SourceFile import dotty.tools.pc.printer.ShortenedTypePrinter import dotty.tools.pc.printer.ShortenedTypePrinter.IncludeDefaultParam -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l import scala.jdk.CollectionConverters.* diff --git a/presentation-compiler/src/main/dotty/tools/pc/SymbolInformationProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/SymbolInformationProvider.scala index aa1508f89313..0743361f255d 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/SymbolInformationProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/SymbolInformationProvider.scala @@ -12,9 +12,9 @@ import dotty.tools.dotc.core.Flags import dotty.tools.dotc.core.Names.* import dotty.tools.dotc.core.StdNames.nme import dotty.tools.dotc.core.Symbols.* -import dotty.tools.pc.utils.MtagsEnrichments.metalsDealias +import dotty.tools.pc.utils.InteractiveEnrichments.deepDealias import dotty.tools.pc.SemanticdbSymbols -import dotty.tools.pc.utils.MtagsEnrichments.allSymbols +import dotty.tools.pc.utils.InteractiveEnrichments.allSymbols class SymbolInformationProvider(using Context): private def toSymbols( @@ -77,7 +77,7 @@ class SymbolInformationProvider(using Context): then classSym.asClass.parentSyms.map(SemanticdbSymbols.symbolName) else Nil val dealisedSymbol = - if sym.isAliasType then sym.info.metalsDealias.typeSymbol else sym + if sym.isAliasType then sym.info.deepDealias.typeSymbol else sym val classOwner = sym.ownersIterator.drop(1).find(s => s.isClass || s.is(Flags.Module)) val overridden = sym.denot.allOverriddenSymbols.toList diff --git a/presentation-compiler/src/main/dotty/tools/pc/WorksheetSemanticdbProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/WorksheetSemanticdbProvider.scala index 4c8c92759a3b..bd9efb49d148 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/WorksheetSemanticdbProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/WorksheetSemanticdbProvider.scala @@ -2,7 +2,7 @@ package dotty.tools.pc import java.nio.file.Path -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* trait WorksheetSemanticdbProvider: diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala index 31bf7c348119..81337c7d8dcb 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala @@ -12,7 +12,7 @@ import dotty.tools.dotc.ast.tpd.Tree import dotty.tools.dotc.ast.untpd.ImportSelector import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.StdNames.* -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteIvyCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteIvyCompletions.scala index ec4a1813a437..718b57cd4828 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteIvyCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteIvyCompletions.scala @@ -4,7 +4,7 @@ import scala.meta.internal.mtags.CoursierComplete import dotty.tools.dotc.ast.untpd.ImportSelector import dotty.tools.dotc.core.Contexts.Context -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* object AmmoniteIvyCompletions: def contribute( diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionPos.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionPos.scala index 6e828f8f2058..ad571ff843c3 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionPos.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionPos.scala @@ -10,7 +10,7 @@ import dotty.tools.dotc.core.Contexts.* import dotty.tools.dotc.util.SourcePosition import dotty.tools.dotc.util.Spans.* import dotty.tools.dotc.interactive.Completion -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionProvider.scala index 7e02c23229e8..9cd98de33141 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionProvider.scala @@ -22,7 +22,7 @@ import dotty.tools.pc.AutoImports.AutoImportEdits import dotty.tools.pc.AutoImports.AutoImportsGenerator import dotty.tools.pc.printer.ShortenedTypePrinter import dotty.tools.pc.printer.ShortenedTypePrinter.IncludeDefaultParam -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j.Command import org.eclipse.lsp4j.CompletionItem diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionValue.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionValue.scala index e1877a1a9c88..9071b2cd2a23 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionValue.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionValue.scala @@ -10,7 +10,7 @@ import dotty.tools.dotc.core.StdNames.nme import dotty.tools.dotc.core.Symbols.Symbol import dotty.tools.dotc.core.Types.Type import dotty.tools.pc.printer.ShortenedTypePrinter -import dotty.tools.pc.utils.MtagsEnrichments.decoded +import dotty.tools.pc.utils.InteractiveEnrichments.decoded import org.eclipse.lsp4j.CompletionItemKind import org.eclipse.lsp4j.CompletionItemTag diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala index 3f2d89a15b72..052287193540 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala @@ -33,7 +33,9 @@ import dotty.tools.dotc.util.SrcPos import dotty.tools.pc.AutoImports.AutoImportsGenerator import dotty.tools.pc.buildinfo.BuildInfo import dotty.tools.pc.completions.OverrideCompletions.OverrideExtractor -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* +import dotty.tools.dotc.core.Denotations.SingleDenotation +import dotty.tools.dotc.interactive.Interactive class Completions( text: String, diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/FilenameCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/FilenameCompletions.scala index a9dfa55f89bd..8d2e97856e82 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/FilenameCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/FilenameCompletions.scala @@ -4,7 +4,7 @@ package completions import dotty.tools.dotc.ast.tpd.TypeDef import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.Flags -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* object FilenameCompletions: diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/InterpolatorCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/InterpolatorCompletions.scala index 9c973e6e63e0..2e39c17b24b3 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/InterpolatorCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/InterpolatorCompletions.scala @@ -15,7 +15,7 @@ import dotty.tools.dotc.core.Symbols.Symbol import dotty.tools.dotc.core.Types.Type import dotty.tools.pc.CompilerSearchVisitor import dotty.tools.pc.IndexedContext -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala index 908865124f58..3ca57fc39cdf 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala @@ -32,7 +32,7 @@ import dotty.tools.pc.AutoImports.SymbolImport import dotty.tools.pc.MetalsInteractive.* import dotty.tools.pc.printer.ShortenedTypePrinter import dotty.tools.pc.printer.ShortenedTypePrinter.IncludeDefaultParam -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l @@ -86,12 +86,12 @@ object CaseKeywordCompletion: ) => val args = head.argTypes.init if args.length > 1 then - Some(definitions.tupleType(args).widen.metalsDealias) - else args.headOption.map(_.widen.metalsDealias) + Some(definitions.tupleType(args).widen.deepDealias) + else args.headOption.map(_.widen.deepDealias) case _ => None case _ => None case sel => - Some(sel.tpe.widen.metalsDealias) + Some(sel.tpe.widen.deepDealias) selTpe .map { selTpe => @@ -156,7 +156,7 @@ object CaseKeywordCompletion: indexedContext.scopeSymbols .foreach(s => - val ts = s.info.metalsDealias.typeSymbol + val ts = s.info.deepDealias.typeSymbol if isValid(ts) then visit(autoImportsGen.inferSymbolImport(ts)) ) // Step 2: walk through known subclasses of sealed types. @@ -259,8 +259,8 @@ object CaseKeywordCompletion: clientSupportsSnippets ) - val tpeStr = printer.tpe(selector.tpe.widen.metalsDealias.bounds.hi) - val tpe = selector.typeOpt.widen.metalsDealias.bounds.hi match + val tpeStr = printer.tpe(selector.tpe.widen.deepDealias.bounds.hi) + val tpe = selector.typeOpt.widen.deepDealias.bounds.hi match case tr @ TypeRef(_, _) => tr.underlying case t => t diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/NamedArgCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/NamedArgCompletions.scala index 8ac5ef64af10..647b151a635b 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/NamedArgCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/NamedArgCompletions.scala @@ -29,7 +29,7 @@ import dotty.tools.dotc.core.Types.TypeBounds import dotty.tools.dotc.core.Types.WildcardType import dotty.tools.dotc.util.SourcePosition import dotty.tools.pc.IndexedContext -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import scala.annotation.tailrec object NamedArgCompletions: diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/OverrideCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/OverrideCompletions.scala index 8d96396999da..df0bb70b596c 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/OverrideCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/OverrideCompletions.scala @@ -29,7 +29,7 @@ import dotty.tools.pc.AutoImports.AutoImport import dotty.tools.pc.AutoImports.AutoImportsGenerator import dotty.tools.pc.printer.ShortenedTypePrinter import dotty.tools.pc.printer.ShortenedTypePrinter.IncludeDefaultParam -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j as l diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/ScalaCliCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/ScalaCliCompletions.scala index fce35ab69ce3..e2a0a033ee6b 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/ScalaCliCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/ScalaCliCompletions.scala @@ -4,7 +4,7 @@ import scala.meta.internal.mtags.CoursierComplete import dotty.tools.dotc.ast.tpd.* import dotty.tools.dotc.util.SourcePosition -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* class ScalaCliCompletions( coursierComplete: CoursierComplete, diff --git a/presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala b/presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala index a7cf1a703a1f..559e199f3449 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala @@ -29,7 +29,7 @@ import dotty.tools.pc.AutoImports.ImportSel.Rename import dotty.tools.pc.IndexedContext import dotty.tools.pc.IndexedContext.Result import dotty.tools.pc.Params -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.eclipse.lsp4j.TextEdit diff --git a/presentation-compiler/src/main/dotty/tools/pc/utils/MtagsEnrichments.scala b/presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala similarity index 96% rename from presentation-compiler/src/main/dotty/tools/pc/utils/MtagsEnrichments.scala rename to presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala index e4385392973f..fb41e8859801 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/utils/MtagsEnrichments.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala @@ -20,8 +20,7 @@ import dotty.tools.dotc.core.Names.* import dotty.tools.dotc.core.StdNames.* import dotty.tools.dotc.core.SymDenotations.NoDenotation import dotty.tools.dotc.core.Symbols.* -import dotty.tools.dotc.core.Types.AppliedType -import dotty.tools.dotc.core.Types.Type +import dotty.tools.dotc.core.Types.* import dotty.tools.dotc.interactive.Interactive import dotty.tools.dotc.interactive.InteractiveDriver import dotty.tools.dotc.util.SourcePosition @@ -31,7 +30,7 @@ import dotty.tools.pc.SemanticdbSymbols import org.eclipse.lsp4j as l -object MtagsEnrichments extends CommonMtagsEnrichments: +object InteractiveEnrichments extends CommonMtagsEnrichments: extension (driver: InteractiveDriver) @@ -399,11 +398,16 @@ object MtagsEnrichments extends CommonMtagsEnrichments: end extension extension (tpe: Type) - def metalsDealias(using Context): Type = + def deepDealias(using Context): Type = tpe.dealias match case app @ AppliedType(tycon, params) => - // we dealias applied type params by hand, because `dealias` doesn't do it - AppliedType(tycon, params.map(_.metalsDealias)) + AppliedType(tycon, params.map(_.deepDealias)) + case aliasingBounds: AliasingBounds => + aliasingBounds.derivedAlias(aliasingBounds.alias.dealias) + case TypeBounds(lo, hi) => + TypeBounds(lo.dealias, hi.dealias) + case RefinedType(parent, name, refinedInfo) => + RefinedType(parent.dealias, name, refinedInfo.deepDealias) case dealised => dealised -end MtagsEnrichments +end InteractiveEnrichments diff --git a/presentation-compiler/test/dotty/tools/pc/base/BaseCompletionSuite.scala b/presentation-compiler/test/dotty/tools/pc/base/BaseCompletionSuite.scala index 776aab8bc2f7..3e5269b947a0 100644 --- a/presentation-compiler/test/dotty/tools/pc/base/BaseCompletionSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/base/BaseCompletionSuite.scala @@ -9,7 +9,7 @@ import scala.meta.pc.CancelToken import scala.language.unsafeNulls import dotty.tools.pc.completions.CompletionSource -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import dotty.tools.pc.utils.{TestCompletions, TextEdits} import org.eclipse.lsp4j.{CompletionItem, CompletionList} diff --git a/presentation-compiler/test/dotty/tools/pc/base/BaseHoverSuite.scala b/presentation-compiler/test/dotty/tools/pc/base/BaseHoverSuite.scala index 0b8d663f8b33..0f385631d9dc 100644 --- a/presentation-compiler/test/dotty/tools/pc/base/BaseHoverSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/base/BaseHoverSuite.scala @@ -5,7 +5,7 @@ import java.nio.file.Paths import scala.meta.internal.metals.{CompilerOffsetParams, CompilerRangeParams} import scala.language.unsafeNulls -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import dotty.tools.pc.utils.{RangeReplace, TestHovers} abstract class BaseHoverSuite diff --git a/presentation-compiler/test/dotty/tools/pc/base/BasePcDefinitionSuite.scala b/presentation-compiler/test/dotty/tools/pc/base/BasePcDefinitionSuite.scala index 8269d4ce1c44..58c2bcdb171c 100644 --- a/presentation-compiler/test/dotty/tools/pc/base/BasePcDefinitionSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/base/BasePcDefinitionSuite.scala @@ -8,7 +8,7 @@ import scala.language.unsafeNulls import dotty.tools.dotc.util.Spans.Span import dotty.tools.dotc.util.{SourceFile, SourcePosition} -import dotty.tools.pc.utils.MtagsEnrichments.toLsp +import dotty.tools.pc.utils.InteractiveEnrichments.toLsp import dotty.tools.pc.utils.TextEdits import org.eclipse.lsp4j.TextEdit diff --git a/presentation-compiler/test/dotty/tools/pc/tests/hover/HoverDefnSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/hover/HoverDefnSuite.scala index 7a647fa40f5f..f4ce4473e60a 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/hover/HoverDefnSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/hover/HoverDefnSuite.scala @@ -223,13 +223,8 @@ class HoverDefnSuite extends BaseHoverSuite: | <> |} |""".stripMargin, - """|**Expression type**: - |```scala - |Option[Int] - |``` - |**Symbol signature**: - |```scala - |val x: Option[T] + """|```scala + |val x: Option[Int] |``` |""".stripMargin.hover ) diff --git a/presentation-compiler/test/dotty/tools/pc/tests/hover/HoverTermSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/hover/HoverTermSuite.scala index d1e90241e639..b51974b00fb0 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/hover/HoverTermSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/hover/HoverTermSuite.scala @@ -653,3 +653,33 @@ class HoverTermSuite extends BaseHoverSuite: |``` |""".stripMargin ) + + @Test def `dealias-type-members-in-structural-types1`: Unit = + check( + """object Obj { + | trait A extends Sup { self => + | type T + | def member : T + | } + | val x: A { type T = Int} = ??? + | + | <> + | + |}""".stripMargin, + """def member: Int""".stripMargin.hover + ) + + @Test def `dealias-type-members-in-structural-types2`: Unit = + check( + """object Obj: + | trait A extends Sup { self => + | type T + | def fun(body: A { type T = self.T} => Unit) = () + | } + | val x: A { type T = Int} = ??? + | + | x.fun: <> => + | () + |""".stripMargin, + """yy: A{type T = Int}""".stripMargin.hover + ) diff --git a/presentation-compiler/test/dotty/tools/pc/utils/PcAssertions.scala b/presentation-compiler/test/dotty/tools/pc/utils/PcAssertions.scala index 6dfc8acec66c..ef15121c6702 100644 --- a/presentation-compiler/test/dotty/tools/pc/utils/PcAssertions.scala +++ b/presentation-compiler/test/dotty/tools/pc/utils/PcAssertions.scala @@ -4,7 +4,7 @@ import scala.language.unsafeNulls import dotty.tools.pc.completions.CompletionSource import dotty.tools.dotc.util.DiffUtil -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import org.hamcrest import org.hamcrest.* diff --git a/presentation-compiler/test/dotty/tools/pc/utils/TestInlayHints.scala b/presentation-compiler/test/dotty/tools/pc/utils/TestInlayHints.scala index 98ebb0852735..a923b76b955c 100644 --- a/presentation-compiler/test/dotty/tools/pc/utils/TestInlayHints.scala +++ b/presentation-compiler/test/dotty/tools/pc/utils/TestInlayHints.scala @@ -3,7 +3,7 @@ package dotty.tools.pc.utils import scala.collection.mutable.ListBuffer import scala.meta.internal.jdk.CollectionConverters._ -import dotty.tools.pc.utils.MtagsEnrichments.* +import dotty.tools.pc.utils.InteractiveEnrichments.* import dotty.tools.pc.utils.TextEdits import org.eclipse.lsp4j.InlayHint