Skip to content

Commit f30279f

Browse files
committed
Avoid hot closure creation in sourceVersion
1 parent 0c974fd commit f30279f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/config/Feature.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ object Feature:
6868

6969
def sourceVersion(using Context): SourceVersion =
7070
if ctx.compilationUnit == null then sourceVersionSetting
71-
else ctx.compilationUnit.sourceVersion.getOrElse(sourceVersionSetting)
71+
else ctx.compilationUnit.sourceVersion match
72+
case Some(v) => v
73+
case none => sourceVersionSetting
7274

7375
def migrateTo3(using Context): Boolean =
7476
sourceVersion == `3.0-migration` || enabledBySetting(nme.Scala2Compat)

0 commit comments

Comments
 (0)