From 33b499cd04342a49bd5c4f5bf0e2fab88b69069c Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 10 Mar 2013 09:11:50 +0100 Subject: SI-7233 Account for aliased imports in eta expansion. Buggy: treeCopy.Select(sel, sel.qual, sel.name) setSymbol null Select(sel, sel.qual, sel.name) Okay: treeCopy.Select(sel, sel.qual, sel.name) Select(sel, sel.qual, sel.symbol.name) // but doesn't copyAttrs! It is an easy mistake to make, I've found one more occurance: def foo(a: Any) = { import a.{toString => toS}; toS } error: uncaught exception during compilation: scala.reflect.internal.FatalError scala.reflect.internal.FatalError: class Object does not have a member toS at scala.reflect.internal.Definitions$DefinitionsClass.scala$reflect$internal$Definitions$DefinitionsClass$$fatalMissingSymbol(Definitions.scala:1028) A followup commit will address that problem. --- test/files/pos/t7233.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/files/pos/t7233.scala (limited to 'test/files/pos') diff --git a/test/files/pos/t7233.scala b/test/files/pos/t7233.scala new file mode 100644 index 0000000000..ae15c08c35 --- /dev/null +++ b/test/files/pos/t7233.scala @@ -0,0 +1,14 @@ +object Foo { + def bar(i: Int) = i + + def ol(i: Int) = i + def ol(i: String) = i +} +object Test { + import Foo.{ bar => quux, toString => bar, ol => olRenamed} + + val f1 = quux _ + val f1Typed: (Int => Int) = f1 + + val f2: String => String = olRenamed _ +} -- cgit v1.2.3