diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-12 15:06:17 +0100 |
---|---|---|
committer | Tobias Schlatter <tobias@meisch.ch> | 2014-03-20 20:25:05 +0100 |
commit | a4516eac1be98830c99ea48e9baedf022dfcb9f7 (patch) | |
tree | 8e0e62943160fb948bf338ace7b01bd0990ad2bc /tests/pos/t0032.scala | |
parent | 5b687fbee23060fbed285f090e3592f2b8cb6beb (diff) | |
download | dotty-a4516eac1be98830c99ea48e9baedf022dfcb9f7.tar.gz dotty-a4516eac1be98830c99ea48e9baedf022dfcb9f7.tar.bz2 dotty-a4516eac1be98830c99ea48e9baedf022dfcb9f7.zip |
Hygienic desugaring
Made desugaring hygienic. Trees that are derived from some other tree are no longer stored as simple
untyped Ident trees, but as TypeTrees that know how to derive their types from some other type.
Test cases in pos: hygiene.scala, t0054.scala and t0085.scala.
The comment in hygiene.scala points to the difficulties we are facing. In particular, we need type
trees that can rebind some references of a source type to local occurrences with the same name. t0054.scala is similar to hygiene.scala. t0085.scala is trickier, but also related. Essentially the problem there is that we have a class
that inherits its outer class. In this case it is important to resolve an identifier in the right context. The identifier added to the copy method of a case class must be resolved outside the class (just like the same
identifier in the constructor of that case class).
Diffstat (limited to 'tests/pos/t0032.scala')
-rw-r--r-- | tests/pos/t0032.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/pos/t0032.scala b/tests/pos/t0032.scala new file mode 100644 index 000000000..727a7d4e9 --- /dev/null +++ b/tests/pos/t0032.scala @@ -0,0 +1,17 @@ +import java.io.{OutputStream, PrintStream}; + +class PromptStream(s: OutputStream) extends PrintStream(s) { + override def println() = super.println(); +} + +object Main { + + val out = new PromptStream(java.lang.System.out); + + java.lang.System.setOut(out); + + def main(args: Array[String]) = + //out.println("hello world"); + () + +} |