diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-09-15 04:19:11 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-09-15 04:19:11 -0700 |
commit | f3d9bdc283a82b816218aefc3df7d287e0cdd271 (patch) | |
tree | 6d0cc6fa3b80e099f61b0bb97a996b8987d38a10 /test/files/pos | |
parent | cb5519a539b6af7b0312f059ab6d7d94b759dae2 (diff) | |
parent | 330ead53be9569f0069be5f6ab62d82cd7c8367f (diff) | |
download | scala-f3d9bdc283a82b816218aefc3df7d287e0cdd271.tar.gz scala-f3d9bdc283a82b816218aefc3df7d287e0cdd271.tar.bz2 scala-f3d9bdc283a82b816218aefc3df7d287e0cdd271.zip |
Merge pull request #2931 from paulp/pr/TreeDSL
Reducing variation of tree creation methods.
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/infersingle.scala | 51 | ||||
-rw-r--r-- | test/files/pos/private-types-after-typer.scala | 9 |
2 files changed, 58 insertions, 2 deletions
diff --git a/test/files/pos/infersingle.scala b/test/files/pos/infersingle.scala index 6830fcd799..60f4ff07e6 100644 --- a/test/files/pos/infersingle.scala +++ b/test/files/pos/infersingle.scala @@ -1,5 +1,52 @@ -object Test { +object Test1 { def one[T](x: T): Option[T] = Some(x) val x = "one" val y: Option[x.type] = one(x) -}
\ No newline at end of file +} + +object Test2 { + // Has never worked, but seems desirable given the recent changes to + // pattern type inference. + val a = "" + object Id { + def unapply(xxxx: Any): Some[a.type] = Some[a.type](a) + } + val b: a.type = (a: a.type) match { + case Id(x) => x + } +} + +object Test3 { + val a = "" + object Id { + def unapply(xxxx: Any): Some[Test3.type] = Some[Test3.type](Test3) + } + val b: Test3.type = a match { + case Id(x) => x + } +} + +class Test4 { + val a = "" + object Id { + def unapply(xxxx: Any): Some[Test4.this.type] = Some[Test4.this.type](Test4.this) + } + val b: Test4.this.type = a match { + case Id(x) => x + } +} + +class Super5 { + final val q = "" + def q1: q.type = q +} + +class Test5 extends Super5 { + val a = "" + object Id { + def unapply(xxxx: Any): Some[Test5.super.q.type] = Some[Test5.super.q.type](q1) + } + val b: Test5.super.q.type = a match { + case Id(x) => x + } +} diff --git a/test/files/pos/private-types-after-typer.scala b/test/files/pos/private-types-after-typer.scala new file mode 100644 index 0000000000..79ef934063 --- /dev/null +++ b/test/files/pos/private-types-after-typer.scala @@ -0,0 +1,9 @@ +// Testing that the type of the outer accessor in O2 +// doesn't crash the compiler over private type escaping scope. +trait T { + class C { + private object O1 { + object O2 + } + } +}
\ No newline at end of file |