diff options
author | Nicolas Stucki <nicolas.stucki@gmail.com> | 2016-06-03 15:00:10 +0200 |
---|---|---|
committer | Nicolas Stucki <nicolas.stucki@gmail.com> | 2016-07-07 11:10:45 +0200 |
commit | 5a7cacbb37f8f1edfded03a095eb45c04a883185 (patch) | |
tree | e00dc214c0c8236141f0d99531e0d211f77df8df /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 75da0358fd7866f3dccdfcf4fbeae9af8ccc69f3 (diff) | |
download | dotty-5a7cacbb37f8f1edfded03a095eb45c04a883185.tar.gz dotty-5a7cacbb37f8f1edfded03a095eb45c04a883185.tar.bz2 dotty-5a7cacbb37f8f1edfded03a095eb45c04a883185.zip |
Add scala.Dynamic language feature check.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 019c460e8..34400ede7 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1092,7 +1092,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit .withType(dummy.nonMemberTermRef) checkVariance(impl1) if (!cls.is(AbstractOrTrait) && !ctx.isAfterTyper) checkRealizableBounds(cls.typeRef, cdef.pos) - assignType(cpy.TypeDef(cdef)(name, impl1, Nil), cls) + val cdef1 = assignType(cpy.TypeDef(cdef)(name, impl1, Nil), cls) + if (ctx.phase.isTyper && cdef1.tpe.derivesFrom(defn.DynamicClass) && !ctx.dynamicsEnabled) { + val isRequired = parents1.exists(_.tpe.isRef(defn.DynamicClass)) + ctx.featureWarning(nme.dynamics.toString, "extension of type scala.Dynamic", isScala2Feature = true, + cls, isRequired, cdef.pos) + } + cdef1 // todo later: check that // 1. If class is non-abstract, it is instantiatable: |