Skip to content

Commit 0fe3072

Browse files
committed
Remove unnecessary check in typedReturn
`return` outside a type definition would result in a parsing error. Therefore the context cannot be `NoContext`.
1 parent 8d04b6b commit 0fe3072

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
979979
}
980980
def enclMethInfo(cx: Context): (Tree, Type) = {
981981
val owner = cx.owner
982-
if (cx == NoContext || owner.isType) {
982+
if (owner.isType) {
983983
ctx.error("return outside method definition", tree.pos)
984984
(EmptyTree, WildcardType)
985985
}

0 commit comments

Comments
 (0)