diff options
author | Martin Odersky <odersky@gmail.com> | 2015-05-16 11:23:50 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-05-21 17:41:13 +0200 |
commit | 9ab86534d7225edcafd3e16849b638c1d99aea69 (patch) | |
tree | 07d7e709c77f878442e7c1d3bda7f0189296db9d /src/dotty/tools/dotc/core/Types.scala | |
parent | 3d9d90e1a29a80f9df968a0e53e01ecb31c397c7 (diff) | |
download | dotty-9ab86534d7225edcafd3e16849b638c1d99aea69.tar.gz dotty-9ab86534d7225edcafd3e16849b638c1d99aea69.tar.bz2 dotty-9ab86534d7225edcafd3e16849b638c1d99aea69.zip |
Add "Printing" mode
Idea: when printing, we should be more lenient about conditions that
would otherwise cause an assertion failure, because we want to avoid
triggering further assertions while diagnosing previous errors. As a start
we generalize an assertion that RefinedTypes cannot be created after erasure.
This gets triggered when playing around with printing lambdas at erasure time
(see following commit): erasure runs at phase erasure + 1, so ctx.erasedTypes is true,
but we might still want to print lambdas then, and printing lambdas will create new
refined types as of next commit.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 3ab621db1..7d11ffae8 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1842,7 +1842,7 @@ object Types { else make(RefinedType(parent, names.head, infoFns.head), names.tail, infoFns.tail) def apply(parent: Type, name: Name, infoFn: RefinedType => Type)(implicit ctx: Context): RefinedType = { - assert(!ctx.erasedTypes) + assert(!ctx.erasedTypes || ctx.mode.is(Mode.Printing)) ctx.base.uniqueRefinedTypes.enterIfNew(new CachedRefinedType(parent, name, infoFn)).checkInst } |