diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/KeywordsCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/KeywordsCompletions.scala index abbf43174bc7..5dd3c8dead4d 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/KeywordsCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/KeywordsCompletions.scala @@ -216,6 +216,7 @@ object KeywordsCompletions: case untpd.TypeDef(_, template: Template) => checkForPossibleKeywords(template) case untpd.ModuleDef(_, template: Template) => checkForPossibleKeywords(template) case template: Template => checkForPossibleKeywords(template) + case _ => TemplateKeywordAvailability.default }.getOrElse(TemplateKeywordAvailability.default) diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala index ab28baea994b..4a30f9b06efa 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala @@ -2150,3 +2150,21 @@ class CompletionSuite extends BaseCompletionSuite: |""".stripMargin, assertSingleItem = false ) + + @Test def `metals-i6861` = + check( + """|trait Builder[Alg]: + | def withTraces: String + | + |trait BuilderFactory: + | def transformRouter(f: [Alg] => Builder[Alg] => String): BuilderFactory + | def build: Unit + | + |def demo = + | (??? : BuilderFactory) + | .transformRouter([Alg] => _.withTraces) + | .build@@ + |""".stripMargin, + """|build: Unit + |""".stripMargin, + )