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

closure in locally defined trait crashes in MixinTransformer #2897

Closed
scabug opened this issue Jan 13, 2010 · 5 comments
Closed

closure in locally defined trait crashes in MixinTransformer #2897

scabug opened this issue Jan 13, 2010 · 5 comments
Assignees

Comments

@scabug
Copy link

@scabug scabug commented Jan 13, 2010

[Update: I hit this again and here is how you can hit it too.]

  def f1(t: String) = {
    trait T {
      def xs = Nil map (_ => t)
    }
    ()
  }
Exception in thread "main" java.lang.AssertionError: assertion failed
	at scala.Predef$$.assert(Predef.scala:79)
	at scala.tools.nsc.transform.Mixin$$MixinTransformer.scala$$tools$$nsc$$transform$$Mixin$$MixinTransformer$$$$postTransform(Mixin.scala:1031)
	at scala.tools.nsc.transform.Mixin$$MixinTransformer$$$$anonfun$$16.apply(Mixin.scala:1057)
	at scala.tools.nsc.transform.Mixin$$MixinTransformer$$$$anonfun$$16.apply(Mixin.scala:1057)
	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:104)
	at scala.tools.nsc.transform.Mixin$$MixinTransformer.transform(Mixin.scala:1057)

[Original report follows]
I haven't reduced this yet, but it's easy to reproduce: take current trunk as (r20482 right now) and one line in IndexedSeqViewLike.scala.

  trait Filtered extends Transformed[A] with super.Filtered {
    // add this override
    override def foreach[U](f: A => U) = super[Transformed].foreach(f)
  }

And scalac will crash with:

[scalacfork] Exception in thread "main" java.lang.AssertionError: assertion failed
[scalacfork] 	at scala.Predef$$.assert(Predef.scala:89)
[scalacfork] 	at scala.tools.nsc.transform.Mixin$$MixinTransformer.scala$$tools$$nsc$$transform$$Mixin$$MixinTransformer$$$$postTransform(Mixin.scala:1012)
[scalacfork] 	at scala.tools.nsc.transform.Mixin$$MixinTransformer$$$$anonfun$$16.apply(Mixin.scala:1060)
[scalacfork] 	at scala.tools.nsc.transform.Mixin$$MixinTransformer$$$$anonfun$$16.apply(Mixin.scala:1060)
[scalacfork] 	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:99)
[...]
@scabug
Copy link
Author

@scabug scabug commented Jan 13, 2010

@scabug
Copy link
Author

@scabug scabug commented Jan 14, 2010

@paulp said:
Oh, and hopefully I don't have to say this, but please don't interpret the fact that I reverted the lines in the above example as in any way invalidating this bug. It's the opposite, this bug may have stood between me and a solution to #2876. Not for sure, but it's irrelevant because this bug is real and reproducible: but you might need to check out r20482 to easily reproduce it.

@scabug
Copy link
Author

@scabug scabug commented Apr 6, 2010

@paulp said:
I just hit this one again. I keep finding my own opened tickets when searching to make sure I'm not opening a duplicate. That is the universe's way of telling me "fix it yourself!"

This time I was able to create a small reproduction, which I am putting in the description.

@scabug
Copy link
Author

@scabug scabug commented Apr 9, 2010

@odersky said:
(In r21420) Interrupted attempt to fix #2897. I am committing what I have because the refactorings improve things a little bit. To fix the ticket a frightening lot more has to be done.

@scabug scabug closed this Mar 15, 2013
@scabug
Copy link
Author

@scabug scabug commented Mar 15, 2013

@paulp said:
Closing as a duplicate of #6231.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants