diff options
author | Martin Odersky <odersky@gmail.com> | 2016-02-01 00:08:26 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-02-09 09:43:07 +0100 |
commit | defba2af7c3b49231962a6f882173bcaff914fcc (patch) | |
tree | 16149a87ac1422d5eac51e4e563f56eda743562c /src/dotty/tools/dotc/typer/Checking.scala | |
parent | 3637e08033c857e19862ae1fc9730d96cdba3fe2 (diff) | |
download | dotty-defba2af7c3b49231962a6f882173bcaff914fcc.tar.gz dotty-defba2af7c3b49231962a6f882173bcaff914fcc.tar.bz2 dotty-defba2af7c3b49231962a6f882173bcaff914fcc.zip |
Check that non-abstract classes have realizable bounds.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Checking.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index ca7c5c5ab..7e90d755b 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -330,6 +330,13 @@ trait Checking { } } + /** Check that all type members of `tp` have realizable bounds */ + def checkRealizableBounds(tp: Type, pos: Position)(implicit ctx: Context): Unit = { + val rstatus = ctx.boundsRealizability(tp) + if (rstatus ne TypeOps.Realizable) + ctx.error(i"$tp cannot be instantiated since it${rstatus.msg}", pos) + } + /** Check that `tp` is a class type with a stable prefix. Also, if `traitReq` is * true check that `tp` is a trait. * Stability checking is disabled in phases after RefChecks. |