From b0ac014abb94beefeb502ec72bfd6f055cd03a47 Mon Sep 17 00:00:00 2001 From: GavinRay97 Date: Sat, 3 Jul 2021 12:31:53 -0400 Subject: [PATCH] Fixes #12998 - Crash when calling `Compiler.newRun()` without a `docCtx` Changes based on suggestion in the issue and the implementation currently seen here: https://github.com/lampepfl/dotty/blob/79fae194b80e136a243e7c7f949268166d169e1e/compiler/src/dotty/tools/dotc/typer/Namer.scala#L449 --- compiler/src/dotty/tools/dotc/core/Definitions.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 6d493a48364d..b0ba7e5176db 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -1781,7 +1781,7 @@ class Definitions { } def addSyntheticSymbolsComments(using Context): Unit = - def add(sym: Symbol, doc: String) = ctx.docCtx.get.addDocstring(sym, Some(Comment(NoSpan, doc))) + def add(sym: Symbol, doc: String) = ctx.docCtx.foreach(_.addDocstring(sym, Some(Comment(NoSpan, doc)))) add(AnyClass, """/** Class `Any` is the root of the Scala class hierarchy. Every class in a Scala