diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-25 17:16:11 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-26 00:16:26 +0200 |
commit | ae28472bc727b25040da4b1428fcb14137d01102 (patch) | |
tree | 6926c1f62994557493270fafaf645783c6d9a30a /test/files/pos/t5958.scala | |
parent | c3ac0ec12ee2b08917cdd0379b868a2fb12171d8 (diff) | |
download | scala-ae28472bc727b25040da4b1428fcb14137d01102.tar.gz scala-ae28472bc727b25040da4b1428fcb14137d01102.tar.bz2 scala-ae28472bc727b25040da4b1428fcb14137d01102.zip |
SI-5958 This deserves a stable type
`this` (or the self variable) passed as an actual argument to a method
should receive a singleton type when computing the method's resultType
this is necessary if the method's type depends on that argument
Diffstat (limited to 'test/files/pos/t5958.scala')
-rw-r--r-- | test/files/pos/t5958.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/files/pos/t5958.scala b/test/files/pos/t5958.scala new file mode 100644 index 0000000000..3b910f3633 --- /dev/null +++ b/test/files/pos/t5958.scala @@ -0,0 +1,15 @@ +class Test { + def newComponent(u: Universe): u.Component = ??? + + class Universe { self => + class Component + + newComponent(this): this.Component // error, but should be fine since this is a stable reference + newComponent(self): self.Component // error, but should be fine since this is a stable reference + newComponent(self): this.Component // error, but should be fine since this is a stable reference + newComponent(this): self.Component // error, but should be fine since this is a stable reference + + val u = this + newComponent(u): u.Component // ok + } +}
\ No newline at end of file |