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

Crash in ScalalintClasses.leakingSealed due to class extending org.scalatest.funsuite.AnyFunSuite #40

Open
gdeOo opened this issue Dec 9, 2019 · 2 comments

Comments

@gdeOo
Copy link

gdeOo commented Dec 9, 2019

The following code cause the ScalalintClasses.leakingSealed rule to crash:

import org.scalatest.funsuite.AnyFunSuite

class MySuite extends AnyFunSuite

The exception:

scalafix.internal.v1.FileException: unexpected error processing file TestTest.scala
Caused by: java.util.NoSuchElementException: org/scalatest/Suite#`?0`#
        at scalafix.internal.v1.SymtabFromProtobuf.$anonfun$info$1(SymtabFromProtobuf.scala:13)
        at scala.Option.getOrElse(Option.scala:189)
        at scalafix.internal.v1.SymtabFromProtobuf.info(SymtabFromProtobuf.scala:13)
        at scalafix.internal.v1.SymtabFromProtobuf.$anonfun$sscope$1(SymtabFromProtobuf.scala:18)
        at scala.collection.Iterator$$anon$10.next(Iterator.scala:459)
        at scala.collection.Iterator.foreach(Iterator.scala:941)
        at scala.collection.Iterator.foreach$(Iterator.scala:941)
  | => kat scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
        at scala.collection.generic.Growable.$plus$plus$eq(Growable.scala:62)
        at scala.collection.generic.Growable.$plus$plus$eq$(Growable.scala:53)
        at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:184)
        at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:47)
        at scala.collection.TraversableOnce.to(TraversableOnce.scala:315)
        at scala.collection.TraversableOnce.to$(TraversableOnce.scala:313)
        at scala.collection.AbstractIterator.to(Iterator.scala:1429)
        at scala.collection.TraversableOnce.toList(TraversableOnce.scala:299)
        at scala.collection.TraversableOnce.toList$(TraversableOnce.scala:299)
        at scala.collection.AbstractIterator.toList(Iterator.scala:1429)
        at scalafix.internal.v1.SymtabFromProtobuf.sscope(SymtabFromProtobuf.scala:18)
        at scalafix.internal.v1.SymtabFromProtobuf$RichScope.convert(SymtabFromProtobuf.scala:126)
        at scalafix.internal.v1.SymtabFromProtobuf.ssignature(SymtabFromProtobuf.scala:98)
        at scalafix.v1.SymbolInformation.signature(SymbolInformation.scala:59)
        at org.scalalint.package$RichSymbol$.$anonfun$getParents$1(package.scala:44)
        at scala.Option.map(Option.scala:230)
        at org.scalalint.package$RichSymbol$.getParents$extension(package.scala:43)
        at org.scalalint.package$RichSymbol$.helper$1(package.scala:34)
        at org.scalalint.package$RichSymbol$.classHierarchy$extension(package.scala:38)
        at org.scalalint.rules.ClassRules.org$scalalint$rules$ClassRules$$checkLeakingSealed(ClassRules.scala:70)
        at org.scalalint.rules.ClassRules$$anonfun$fix$1.applyOrElse(ClassRules.scala:54)
        at org.scalalint.rules.ClassRules$$anonfun$fix$1.applyOrElse(ClassRules.scala:50)
        at scala.PartialFunction$Lifted.apply(PartialFunction.scala:228)
        at scala.PartialFunction$Lifted.apply(PartialFunction.scala:224)
        at scala.meta.transversers.Api$XtensionCollectionLikeUI$traverser$3$.apply(Api.scala:32)
        at scala.meta.transversers.SimpleTraverser.$anonfun$apply$1(SimpleTraverser.scala:5)
        at scala.meta.transversers.SimpleTraverser.$anonfun$apply$1$adapted(SimpleTraverser.scala:5)
        at scala.collection.immutable.List.foreach(List.scala:392)
        at scala.meta.transversers.SimpleTraverser.apply(SimpleTraverser.scala:5)
        at scala.meta.transversers.Api$XtensionCollectionLikeUI$traverser$3$.apply(Api.scala:33)
        at scala.meta.transversers.Api$XtensionCollectionLikeUI.collect(Api.scala:36)
        at org.scalalint.rules.ClassRules.fix(ClassRules.scala:50)
        at scalafix.internal.v1.Rules.$anonfun$semanticPatch$1(Rules.scala:75)
        at scala.collection.immutable.List.map(List.scala:290)
        at scalafix.internal.v1.Rules.semanticPatch(Rules.scala:73)
        at scalafix.internal.v1.MainOps$.unsafeHandleFile(MainOps.scala:233)

Might be related to #38. Still using version scalatest_2.12 3.1.0.

@pdalpra
Copy link
Owner

pdalpra commented Dec 9, 2019

Seems like scalatest 3.1.0 is full of edge cases to handle :)
I'll have a look!

@pdalpra
Copy link
Owner

pdalpra commented May 28, 2020

Very sorry about the huge delay, didn't have as much free time as I'd like to tackle it...
Going to fix this in the coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants