Skip to content

Commit 116bcef

Browse files
committed
Disallow abstract methods in extensions
1 parent b85bd2d commit 116bcef

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3484,6 +3484,8 @@ object Parsers {
34843484
else if tparams.nonEmpty && stat.tparams.nonEmpty then
34853485
syntaxError(i"extension method cannot have type parameters since some were already given previously",
34863486
stat.tparams.head.span)
3487+
else if stat.rhs.isEmpty then
3488+
syntaxError(i"extension method cannot be abstract", stat.span)
34873489
case stat =>
34883490
syntaxError(i"extension clause can only define methods", stat.span)
34893491
}

compiler/src/dotty/tools/dotc/typer/Nullables.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ object Nullables:
170170
case info :: infos1 =>
171171
if info.asserted.contains(ref) then true
172172
else if info.retracted.contains(ref) then false
173-
else impliesNotNull(infos1)(ref)
173+
else infos1.impliesNotNull(ref)
174174
case _ =>
175175
false
176176

0 commit comments

Comments
 (0)