Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abstract override crasher. #4134

Closed
scabug opened this issue Jan 6, 2011 · 5 comments
Closed

abstract override crasher. #4134

scabug opened this issue Jan 6, 2011 · 5 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jan 6, 2011

trait T1 {
  def f: Unit
}                                                                               

trait T2 extends T1 {
  abstract override def f: Unit = "in T1"
  def something = super.f  // So the "abstract override" is needed
}                                                                               

trait Q1 {
  def f: Unit = "bippy"
}                                                                               

trait T3 extends T2 with Q1 {
  abstract override def f: Unit = "in T2"
}

object Test {
  def main(args: Array[String]): Unit = {
    new T3 { }
  }
}
% scalac29 -version
Scala compiler version 2.9.0.r23890-b20110103193501 -- Copyright 2002-2010, LAMP/EPFL
% scalac29 0106.scala 
Exception in thread "main" java.lang.AssertionError: assertion failed: method f
	at scala.Predef$$.assert(Predef.scala:99)
	at scala.tools.nsc.transform.Mixin$$$$anonfun$$scala$$tools$$nsc$$transform$$Mixin$$$$rebindSuper$$1.apply(Mixin.scala:110)
	at scala.tools.nsc.transform.Mixin$$$$anonfun$$scala$$tools$$nsc$$transform$$Mixin$$$$rebindSuper$$1.apply(Mixin.scala:95)
	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:96)
	at scala.tools.nsc.transform.Mixin.scala$$tools$$nsc$$transform$$Mixin$$$$rebindSuper(Mixin.scala:95)
	at scala.tools.nsc.transform.Mixin$$$$anonfun$$mixinTraitMembers$$1$$1.apply(Mixin.scala:325)
	at scala.tools.nsc.transform.Mixin$$$$anonfun$$mixinTraitMembers$$1$$1.apply(Mixin.scala:278)
	at scala.collection.LinearSeqOptimized$$class.foreach(LinearSeqOptimized.scala:61)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.tools.nsc.transform.Mixin.mixinTraitMembers$$1(Mixin.scala:278)
	at scala.tools.nsc.transform.Mixin$$$$anonfun$$addMixedinMembers$$3.apply(Mixin.scala

Not that the version is super relevant. Even the line numbers are stable.

% scalac26 -version
Scala compiler version 2.6.1-final -- (c) 2002-2007 LAMP/EPFL
% scalac26 0106.scala 
Exception in thread "main" java.lang.AssertionError: assertion failed: method f
	at scala.Predef$$.assert(Predef.scala:96)
	at scala.tools.nsc.transform.Mixin$$$$anonfun$$scala$$tools$$nsc$$transform$$Mixin$$$$rebindSuper$$1.apply(Mixin.scala:111)
	at scala.tools.nsc.transform.Mixin$$$$anonfun$$scala$$tools$$nsc$$transform$$Mixin$$$$rebindSuper$$1.apply(Mixin.scala:96)
	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:89)
	at scala.tools.nsc.transform.Mixin.scala$$tools$$nsc$$transform$$Mixin$$$$rebindSuper(Mixin.scala:96)
	at scala.tools.nsc.transform.Mixin$$$$anonfun$$mixinTraitMembers$$1$$1.apply(Mixin.scala:257)
	at scala.tools.nsc.transform.Mixin$$$$anonfun$$mixinTraitMembers$$1$$1.apply(Mixin.scala:224)
@scabug
Copy link
Author

scabug commented Jan 6, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4134?orig=1
Reporter: @paulp
Other Milestones: 2.10.0-M3

@scabug
Copy link
Author

scabug commented Apr 6, 2012

@som-snytt said:
I took a look and submitted pull request 359.

This commit just changes the assert on a bad abstract super.m to a compiler error. Probably it's the not that simple, right? In this case, review (and rejection) is easy; but if it weren't, should I ask on scala-internals or on the jira ticket? By way of not wasting people's time? I was just looking for small bugs as an excuse to look at code.

This is a great learning experience, but in mid-learning-curve, I don't have a lot of visibility into the code or even a feeling that I'm not doing something dumb or, worse, counter-productive.

Needless to add, test suite passes and collaborator license agreement is verified.

@scabug
Copy link
Author

scabug commented Apr 6, 2012

@paulp said:
scala-internals is the best because a lot of people might respond there, and here you have a potential audience of about five. The patch looks like an improvement, except we don't use Option[Symbol]; that's what NoSymbol is for. It's in develop along with a patch from me addressing that.

@scabug
Copy link
Author

scabug commented Apr 6, 2012

@som-snytt said:
OK, thanks. I'm glad I resisted the urge to use Option.fold for the first time.

@scabug
Copy link
Author

scabug commented Apr 28, 2012

@som-snytt said:
scala/scala#359
72f6f0e57ca490b36cef62a3be2a8b3261476cd2

@scabug scabug closed this as completed Apr 28, 2012
@scabug scabug added this to the 2.10.0-M2 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants