From 3ac03c3d3f0e21f279ba8c405351e445af623ceb Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 9 Aug 2010 11:51:37 +0000 Subject: closes #3582: typedTypeDef needs to run in a ne... closes #3582: typedTypeDef needs to run in a new typer for TypeDefs with type parameters this was honored when typedTypeDef was called by typed1, but other callers did not this would cause higher-order type parameters to be re-entered in the scope of a method or a class (by the way, should we recycle scopes for higher-order type params? now new scopes are created, symbols entered, and tree's symbols updated) changed some spurious vars to vals review by odersky --- test/files/pos/t3582.scala | 12 ++++++++++++ test/files/pos/t3582b.scala | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 test/files/pos/t3582.scala create mode 100644 test/files/pos/t3582b.scala (limited to 'test') diff --git a/test/files/pos/t3582.scala b/test/files/pos/t3582.scala new file mode 100644 index 0000000000..0ac112efbf --- /dev/null +++ b/test/files/pos/t3582.scala @@ -0,0 +1,12 @@ +trait C[A] +object Test { + def ImplicitParamCA[CC[A], A](implicit ev: C[A]) {implicitly[C[A]]} // must use this exact syntax... + // error: could not find implicit value for parameter e: C[A] +} +// [[syntax trees at end of typer]] +// abstract trait C#5[A#9116 >: Nothing#5832 <: Any#52] extends scala#33.AnyRef#2780; +// final object Test#15 extends java.lang.Object#2485 with ScalaObject#1913 { +// def ImplicitParamCA#9123[CC#9124[A#10858 >: Nothing#5832 <: Any#52] >: [A#10858]Nothing#5832 <: [A#10858]Any#52, +// A#9125 >: Nothing#5832 <: Any#52](implicit ev#10856: C#5[A#9127]): Unit#3818 +// = scala#34.this.Predef#1683.implicitly#8816[C#5[A#10858]]() +// } diff --git a/test/files/pos/t3582b.scala b/test/files/pos/t3582b.scala new file mode 100644 index 0000000000..8f0bfb9b2a --- /dev/null +++ b/test/files/pos/t3582b.scala @@ -0,0 +1,5 @@ +object ParamScoping { + // scoping worked fine in the result type, but was wrong in body + // reason: typedTypeDef needs new context, which was set up by typed1 but not by typedDefDef and typedClassDef + def noOverlapFOwithHO[T, G[T]]: G[T] = null.asInstanceOf[G[T]] +} \ No newline at end of file -- cgit v1.2.3