From 0fe307295230c5b27e41e38bbb8e8b6f07530ce5 Mon Sep 17 00:00:00 2001 From: Allan Renucci Date: Wed, 27 Sep 2017 14:03:26 +0200 Subject: [PATCH] Remove unnecessary check in `typedReturn` `return` outside a type definition would result in a parsing error. Therefore the context cannot be `NoContext`. --- compiler/src/dotty/tools/dotc/typer/Typer.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index a69f509a677e..10eab6cc31cf 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -979,7 +979,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } def enclMethInfo(cx: Context): (Tree, Type) = { val owner = cx.owner - if (cx == NoContext || owner.isType) { + if (owner.isType) { ctx.error("return outside method definition", tree.pos) (EmptyTree, WildcardType) }