Skip to content

Changes to overloading #1389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 18, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/pos/hkgadt.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
object HKGADT {
sealed trait Foo[F[_]]
final case class Bar() extends Foo[List]

def frob[F[_]](foo: Foo[F]) =
foo match {
case Bar() => ()
}
}
3 changes: 3 additions & 0 deletions tests/pos/i618.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class C(val f: Any*)

class D(override val f: Nothing) extends C(f)
27 changes: 27 additions & 0 deletions tests/pos/overloaded.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,30 @@ object overloaded {
val a: A = fr(new C)
val b: B = fr(new C)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do a run test to make sure that the correct overload is called.

}

// from #1381

object Foo {
class Bar[T]
implicit def const[T](x: T): Bar[T] = ???

def bar[T](e: T): Any = ???
def bar[T](e: Bar[T]): Any = ???

val b: Bar[Int] = ???
bar(b)
}

object Test2 {
trait A; trait B
class C1 {
def f(x: A): Unit = println("A")
}
class C2 extends C1 {
def f(x: B): Unit = println("B")
}
object Test extends C2 with App {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests should probably be in run to check if the correct overload of f is called.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for class Foo above.

implicit def a2b(x: A): B = new B {}
f(new A {})
}
}