From 3d9d1f6c99d2ee803402b02cccba72086af74b38 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 11 Jan 2015 19:01:09 +1000 Subject: SI-9074 Fix generic substitution with package objects, overloading Takes a leaf out of dotty's book [1] and makes `asSeenFrom` transparently change the prefix from the package class to the package object when needed. This fixes generic subsitution during overload resolution, as reported in SI-9074. This subsumes the former fix for SI-6225, which is removed here. [1] https://github.com/lampepfl/dotty/pull/282 --- test/files/pos/t9074.scala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/files/pos/t9074.scala (limited to 'test/files/pos/t9074.scala') diff --git a/test/files/pos/t9074.scala b/test/files/pos/t9074.scala new file mode 100644 index 0000000000..67db281f54 --- /dev/null +++ b/test/files/pos/t9074.scala @@ -0,0 +1,24 @@ +package blam { + + package foo { + + trait F[T] { + def f(d: Double, t: T): T = ??? + def f(d: Int, t: T): T = ??? + def f(d: String, t: T): T = ??? + + def g[A](a: T): T = ??? + def g(a: Int) = ??? + } + } + + package object foo extends foo.F[Double] { + override def f(d: Double, t: Double): Double = ??? + } +} + +object Test { + import blam._ + foo.f("3", 4.0) + foo.g[Any](1d) : Double +} -- cgit v1.2.3