From c3a3ec272f00fbe91063d408bfbb04a75ff03144 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 20 Mar 2018 20:26:25 +0100 Subject: [PATCH] TreeChecker: check that type variables are instantiated --- compiler/src/dotty/tools/dotc/transform/TreeChecker.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala index 6be342739f75..2fc388373f12 100644 --- a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -475,7 +475,9 @@ class TreeChecker extends Phase with SymTransformer { } object TreeChecker { - /** Check that TypeParamRefs and MethodParams refer to an enclosing type */ + /** - Check that TypeParamRefs and MethodParams refer to an enclosing type. + * - Check that all type variables are instantiated. + */ def checkNoOrphans(tp0: Type, tree: untpd.Tree = untpd.EmptyTree)(implicit ctx: Context) = new TypeMap() { val definedBinders = new java.util.IdentityHashMap[Type, Any] def apply(tp: Type): Type = { @@ -487,6 +489,7 @@ object TreeChecker { case tp: ParamRef => assert(definedBinders.get(tp.binder) != null, s"orphan param: ${tp.show}, hash of binder = ${System.identityHashCode(tp.binder)}, tree = ${tree.show}, type = $tp0") case tp: TypeVar => + assert(tp.isInstantiated, s"Uninstantiated type variable: ${tp.show}, tree = ${tree.show}") apply(tp.underlying) case _ => mapOver(tp)