aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2014-09-24 17:17:17 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-09-24 17:24:58 +0200
commit42b8c1df6e22bf8a8fd982bbd542d6fc427f8deb (patch)
treeebd2c26d4dd0f372923d4dc688d9c5c0b7646586 /src/dotty/tools/dotc
parent112d08118b5f892ba98a465ef8cf8896448245f8 (diff)
downloaddotty-42b8c1df6e22bf8a8fd982bbd542d6fc427f8deb.tar.gz
dotty-42b8c1df6e22bf8a8fd982bbd542d6fc427f8deb.tar.bz2
dotty-42b8c1df6e22bf8a8fd982bbd542d6fc427f8deb.zip
TypeTestsCasts now handles casts to constant types.
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala2
-rw-r--r--src/dotty/tools/dotc/transform/TypeTestsCasts.scala2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 59adf764e..5348bac31 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -255,6 +255,8 @@ object Types {
* value type, or because superclasses are ambiguous).
*/
final def classSymbol(implicit ctx: Context): Symbol = this match {
+ case ConstantType(constant) =>
+ constant.tpe.classSymbol
case tp: TypeRef =>
val sym = tp.symbol
if (sym.isClass) sym else tp.underlying.classSymbol
diff --git a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
index 8c9ffb1fb..4f5c47c99 100644
--- a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
+++ b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
@@ -78,7 +78,7 @@ class TypeTestsCasts extends MiniPhaseTransform {
}
def transformAsInstanceOf(argType: Type): Tree = {
- def argCls = argType.classSymbol
+ def argCls = argType.widen.classSymbol
if (qual.tpe <:< argType)
Typed(qual, tree.args.head)
else if (qualCls.isPrimitiveValueClass) {