We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1a1f878 commit 1b52f09Copy full SHA for 1b52f09
src/dotty/tools/dotc/transform/TreeChecker.scala
@@ -206,6 +206,15 @@ class TreeChecker extends Phase with SymTransformer {
206
}
207
}.apply(tp)
208
209
+
210
+ override def typedReturn(tree: untpd.Return)(implicit ctx: Context): tpd.Return = {
211
+ val ret = super.typedReturn(tree)
212
+ val from = if(ret.from.isEmpty) ctx.owner.enclosingMethod else ret.from.symbol
213
+ val rType = from.info.finalResultType
214
+ assert(ret.expr.tpe <:< rType)
215
+ ret
216
+ }
217
218
override def typedIdent(tree: untpd.Ident, pt: Type)(implicit ctx: Context): Tree = {
219
assert(tree.isTerm || !ctx.isAfterTyper, tree.show + " at " + ctx.phase)
220
assert(tree.isType || !needsSelect(tree.tpe), i"bad type ${tree.tpe} for $tree # ${tree.uniqueId}")
0 commit comments