Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SI-8046 Only use fast TypeRef#baseTypeSeq with concrete base types
We can only compute the base type sequence (BTS) of a `TypeRef` by element-wise transforming the BTS of the referenced symbol if there are no abstract types in its BTS type symbols. In the now-working test case, `pos/t8046.scala`, the difference between the old and new calculation of the BTS is: this = Three.this.Alias[Int] sym.info.baseTypeSeq = BTS(One.this.Op[A],Any) mapped BTS = BTS(Three.this.Op[Int],Any) full BTS = BTS(Three.this.Op[Int],Int => Int,Object,Any) The change to account for PolyType in ArgsTypeRef#transform is now needed to avoid the full BTS of: BTS(Three.this.Op[A],A => A,Object,Any) Interestingly, everything actually works without that change.
- Loading branch information
Showing
5 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
List(trait Op, trait Function1, class Object, class Any) | ||
BTS(T,Three.this.Op[Int],Int => Int,Object,Any) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import scala.tools.partest._ | ||
|
||
object Test extends DirectTest { | ||
override def code = "" | ||
override def extraSettings: String = "-usejavacp" | ||
|
||
override def show() { | ||
val c = newCompiler() | ||
new c.Run | ||
import c._ | ||
|
||
val f4 = typeOf[Three].member(newTermName("f4")) | ||
val f4ParamInfo = f4.paramss.head.head.info | ||
println(f4ParamInfo.baseClasses) | ||
println(f4ParamInfo.baseTypeSeq) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import language._ | ||
|
||
trait One { | ||
type Op[A] | ||
type Alias[A] = Op[A] | ||
} | ||
|
||
trait Three extends One { | ||
trait Op[A] extends (A => A) | ||
|
||
def f4[T <: Alias[Int]](f: T) = 0 | ||
} | ||
|