aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/pos/t3079.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/pos/t3079.scala')
-rw-r--r--tests/untried/pos/t3079.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/untried/pos/t3079.scala b/tests/untried/pos/t3079.scala
new file mode 100644
index 000000000..b7bd63190
--- /dev/null
+++ b/tests/untried/pos/t3079.scala
@@ -0,0 +1,17 @@
+sealed trait Identity[A] {
+ val value: A
+}
+
+trait Coerce[A, B] {
+ def unwrap: (A => B)
+}
+
+object Coerce {
+ def IdentityCoerce[B] = new Coerce[Identity[B], B] {
+ // java.lang.Error: A in trait Identity cannot be instantiated from ?x$1.type
+ def unwrap = _.value
+
+ // Providing the type of _ works around the problem.
+ //def unwrap = (_: Identity[B]).value
+ }
+}