From a4516eac1be98830c99ea48e9baedf022dfcb9f7 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 12 Mar 2014 15:06:17 +0100 Subject: 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). --- tests/pos/t0076.scala | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/pos/t0076.scala (limited to 'tests/pos/t0076.scala') diff --git a/tests/pos/t0076.scala b/tests/pos/t0076.scala new file mode 100644 index 000000000..5419cf515 --- /dev/null +++ b/tests/pos/t0076.scala @@ -0,0 +1,9 @@ +// This is extracted from a test file => don't add a new test file. +object bug { + def foo(i: => Int): Int = 0; + + def bar: Int = { + var i: Int = 0; + foo (i); + } +} -- cgit v1.2.3