Aladdin - Scala Bugtracking
[#619] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin not repro 2006-06-02 16:32:30.0
subject implicit parameter shadowing doesn't work
code
class Context;
object bar {
  implicit def txt0 : Context = null;
}
abstract class Foo {
  import bar._;
  abstract class Bar {
    def foo(implicit txt : Context) : Unit = {
      foo;
    }
  }
}
what happened
java.lang.NullPointerException
	at scala.tools.nsc.symtab.SymbolLoaders$SourcefileLoader.doComplete(SymbolLoaders.scala:221)
	at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:48)
	at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:346)
	at scala.tools.nsc.symtab.Symbols$Symbol.tpe(Symbols.scala:322)
	at scala.tools.nsc.symtab.Types$Type.memberType(Types.scala:203)
	at scala.tools.nsc.symtab.Symbols$Symbol$$anonfun$6.apply(Symbols.scala:633)
	at scala.tools.nsc.symtab.Symbols$Symbol$$anonfun$6.apply(Symbols.scala:632)
	at scala.tools.nsc.symtab.Symbols$Symbol.filter(Symbols.scala:511)
	at scala.tools.nsc.symtab.Symbols$Symbol.matchingSymbol(Symbols.scala:632)
	at scala.tools.nsc.symtab.Symbols$Symbol.overriddenSymbol(Symbols.scala:637)
	at scala.tools.nsc.symtab.Symbols$Symbol$$anonfun$7.apply(Symbols.scala:646)
	at scala.tools.nsc.symtab.Symbols$Symbol$$anonfun$7.apply(Symbols.scala:645)
	at scala.List.map(List.scala:652)
	at scala.tools.nsc.symtab.Symbols$Symbol.allOverriddenSymbols(Symbols.scala:645)
	at ch.epfl.lamp.sdt.ui.scalaeditor.OverrideIndicatorManager$OverrideIndicator.overrides(OverrideIndicatorManage\
r.java:23)
	at ch.epfl.lamp.sdt.ui.scalaeditor.OverrideIndicatorManager$OverrideIndicator.isValid(OverrideIndicatorManager.\
java:44)
	at ch.epfl.lamp.sdt.ui.scalaeditor.OverrideIndicatorManager.refresh(OverrideIndicatorManager.java:75)
	at ch.epfl.lamp.sdt.ui.actions.HighlightAction.run(HighlightAction.java:105)
	at ch.epfl.lamp.sdt.ui.actions.HighlightAction.run(HighlightAction.java:77)
	at ch.epfl.lamp.sdt.ui.actions.HighlightAction$1.run(HighlightAction.java:61)
	at ch.epfl.lamp.sdt.ui.actions.HighlightAction.run(HighlightAction.java:65)
	at ch.epfl.lamp.sdt.ui.scalaeditor.ScalaEditor$1.focusGained(ScalaEditor.java:206)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:105)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1109)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1090)
	at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:2592)
	at org.eclipse.swt.widgets.Control.gtk_event_after(Control.java:2002)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1429)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3796)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:5245)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1133)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1427)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2838)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)
what expected Shouldn't crash.
[back to overview]
Changes of this bug report
Sean  edited on  2006-06-02 16:33:06.0
Martin  edited on  2006-06-04 19:36:10.0
Shadowing is supposed to apply only if the two implicits have the same name.
Sean  edited on  2006-06-07 16:32:24.0
Noisey bug before, crashes compiler on latest revision.
Martin  edited on  2006-06-07 16:48:41.0
I get:
bug619.scala:9 error: ambiguous implicit value:
 both value txt of type Context
 and method txt0 in object bar of type => Context
 match expected type Context
      foo;
      ^
one error found
Martin  edited on  2006-06-07 22:09:43.0
Something's wrong here. The current file SymbolLoaders does not have a line 221 (the one where the NPE occurs); it ends at line 218. Sean, are you sure you use the latest version?