diff options
author | Josh Suereth <joshua.suereth@gmail.com> | 2012-11-01 10:44:30 -0400 |
---|---|---|
committer | Josh Suereth <joshua.suereth@gmail.com> | 2012-11-01 10:44:30 -0400 |
commit | 79087c79c402ababbb50fa9d1e4e78b0e52189c6 (patch) | |
tree | 210f4f0024bffd9a0061285a948079c518342983 /test/files/pos | |
parent | 557fe9e9d2c14f363918e89056233a981dc5ef5c (diff) | |
parent | 17497cbc95d2e3cfe52eb2a1ece0d414e9308660 (diff) | |
download | scala-79087c79c402ababbb50fa9d1e4e78b0e52189c6.tar.gz scala-79087c79c402ababbb50fa9d1e4e78b0e52189c6.tar.bz2 scala-79087c79c402ababbb50fa9d1e4e78b0e52189c6.zip |
Merge branch '2.10.0-wip' of github.com:scala/scala into 2.10.0-wip
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t5031_3/Foo_1.scala | 5 | ||||
-rw-r--r-- | test/files/pos/t5031_3/Main_2.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t5031_3/package.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t6575a.scala | 15 | ||||
-rw-r--r-- | test/files/pos/t6575b.scala | 17 |
5 files changed, 49 insertions, 0 deletions
diff --git a/test/files/pos/t5031_3/Foo_1.scala b/test/files/pos/t5031_3/Foo_1.scala new file mode 100644 index 0000000000..5934a6ba79 --- /dev/null +++ b/test/files/pos/t5031_3/Foo_1.scala @@ -0,0 +1,5 @@ +package foo.bar + +object Foo { + def bar = 42 +} diff --git a/test/files/pos/t5031_3/Main_2.scala b/test/files/pos/t5031_3/Main_2.scala new file mode 100644 index 0000000000..2079460b83 --- /dev/null +++ b/test/files/pos/t5031_3/Main_2.scala @@ -0,0 +1,6 @@ +package org.example + +object Main extends App { + println(foo.bar.Foo.bar) +} + diff --git a/test/files/pos/t5031_3/package.scala b/test/files/pos/t5031_3/package.scala new file mode 100644 index 0000000000..23fede7d04 --- /dev/null +++ b/test/files/pos/t5031_3/package.scala @@ -0,0 +1,6 @@ +package foo + +package object bar { + type Foo = Int => String +} + diff --git a/test/files/pos/t6575a.scala b/test/files/pos/t6575a.scala new file mode 100644 index 0000000000..f128714dab --- /dev/null +++ b/test/files/pos/t6575a.scala @@ -0,0 +1,15 @@ +trait X { def foo: PartialFunction[Int, Int] } + +trait Y extends X { + // Inferred type was AbstractPartialFunction[Int, Int] with Serializable + abstract override def foo = { case i => super.foo(i) * 2 } +} +trait Z extends X { + // ditto + abstract override def foo = { case i => super.foo(i) + 3 } +} + +trait Comb extends Y with Z { + // ... which led to a type error here. + abstract override def foo: PartialFunction[Int, Int] = { case i => super.foo(i) - 2 } +} diff --git a/test/files/pos/t6575b.scala b/test/files/pos/t6575b.scala new file mode 100644 index 0000000000..d3e58b2a16 --- /dev/null +++ b/test/files/pos/t6575b.scala @@ -0,0 +1,17 @@ +// inferred types were okay here as Function nodes aren't +// translated into anoymous subclasses of AbstractFunctionN +// until after the typer. +// +// So this test is just confirmation. +trait X { def foo: Function1[Int, Int] } + +trait Y extends X { + abstract override def foo = { case i => super.foo(i) * 2 } +} +trait Z extends X { + abstract override def foo = { case i => super.foo(i) + 3 } +} + +trait Comb extends Y with Z { + abstract override def foo: Function1[Int, Int] = { case i => super.foo(i) - 2 } +} |