diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2008-02-06 18:02:39 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2008-02-06 18:02:39 +0000 |
commit | 11d8e2c4870d13be7b4a651495aae8fb8946d60f (patch) | |
tree | 6e6f0534d1fd9edb843de85adec93425481879de /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | 9b379d01bf4c1653d015d70aee8df71be8a6904e (diff) | |
download | scala-11d8e2c4870d13be7b4a651495aae8fb8946d60f.tar.gz scala-11d8e2c4870d13be7b4a651495aae8fb8946d60f.tar.bz2 scala-11d8e2c4870d13be7b4a651495aae8fb8946d60f.zip |
Partial fix to #397.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index b1088dd599..1969880022 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -746,16 +746,20 @@ trait Typers { self: Analyzer => assert((mode & HKmode) == 0) //@M instantiate(tree, mode, pt) } else if (tree.tpe <:< pt) { - def isStructuralType(tpe: Type) = tpe match { + def isStructuralType(tpe: Type): Boolean = tpe match { case RefinedType(ps, decls) => decls.toList exists (x => x.isTerm && x.allOverriddenSymbols.isEmpty) case _ => false } if (isStructuralType(pt) && tree.tpe.typeSymbol == ArrayClass) { - println("need to insert box for "+tree) + // all Arrays used as structural refinement typed values must be boxed + // this does not solve the case where the type to be adapted to comes + // from a type variable that was bound by a strctural but is instantiated + typed(Apply(Select(gen.mkAttributedRef(ScalaRunTimeModule), nme.forceBoxedArray), List(tree))) } - tree + else + tree } else { if ((mode & PATTERNmode) != 0) { if ((tree.symbol ne null) && tree.symbol.isModule) |