From 09ac6c27c7e65d1b23525b5f5c6a229278bd26ef Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Wed, 8 Feb 2023 18:59:22 +0100 Subject: [PATCH] bugfix: Make sure symbol exists before calling owner --- .../src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala index 84bc1e77a1ef..91614aaccad2 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala @@ -190,7 +190,7 @@ class ExtractSemanticDB extends Phase: registerUseGuarded(None, privateWithin, spanOfSymbol(privateWithin, tree.span, tree.source), tree.source) else if !excludeSymbol(tree.symbol) then registerSymbol(tree.symbol, symbolKinds(tree)) - case tree: Template if tree.symbol.owner.is(Invisible) => + case tree: Template if tree.symbol != NoSymbol && tree.symbol.owner.is(Invisible) => // do nothing // exclude the symbols and synthetics generated by @main annotation // (main class generated by @main has `Invisible` flag, see `MainProxies.scala`). @@ -201,7 +201,7 @@ class ExtractSemanticDB extends Phase: val selfSpan = tree.self.span if selfSpan.exists && selfSpan.hasLength then traverse(tree.self) - if tree.symbol.owner.isEnumClass then + if tree.symbol != NoSymbol && tree.symbol.owner.isEnumClass then tree.body.foreachUntilImport(traverse).foreach(traverse) // the first import statement else tree.body.foreach(traverse)