Skip to content

-WUnused crash on failed compilation #17335

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

Closed
KacperFKorban opened this issue Apr 24, 2023 · 1 comment · Fixed by #17340
Closed

-WUnused crash on failed compilation #17335

KacperFKorban opened this issue Apr 24, 2023 · 1 comment · Fixed by #17340
Assignees
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug itype:crash
Milestone

Comments

@KacperFKorban
Copy link
Member

Compiler version

3.3.0-RC(1|2|3|4), main

No crash with 3.2.2

Minimized code

//> using scala "3.3.0-RC4"
//> using options "-Wunused:all"

def aMethod() =
  doStuff { (x) => x }

Output (click arrow to expand)

dotty.tools.dotc.ast.Trees$UnAssignedTypeException: type of Function(List(ValDef(x,TypeTree,EmptyTree)),Block(List(),Ident(x))) is not assigned while running checkUnusedPostTyper on unused-error-crash.scala
exception occurred while compiling unused-error-crash.scala
dotty.tools.dotc.ast.Trees$UnAssignedTypeException: type of Function(List(ValDef(x,TypeTree,EmptyTree)),Block(List(),Ident(x))) is not assigned while compiling unused-error-crash.scala
Exception in thread "main" dotty.tools.dotc.ast.Trees$UnAssignedTypeException: type of Function(List(ValDef(x,TypeTree,EmptyTree)),Block(List(),Ident(x))) is not assigned
	at dotty.tools.dotc.ast.Trees$Tree.tpe(Trees.scala:71)
	at dotty.tools.dotc.ast.tpd$TypedTreeCopier.Block(tpd.scala:664)
	at dotty.tools.dotc.transform.MegaPhase.loop$2(MegaPhase.scala:448)
	at dotty.tools.dotc.transform.MegaPhase.transformBlock(MegaPhase.scala:449)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:298)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:427)
	at dotty.tools.dotc.transform.MegaPhase.loop$3(MegaPhase.scala:459)
	at dotty.tools.dotc.transform.MegaPhase.transformTrees(MegaPhase.scala:459)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:279)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:427)
	at dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:248)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:425)
	at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:438)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:438)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:359)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:427)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:255)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:425)
	at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:438)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:438)
	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:379)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:382)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:427)
	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:454)
	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:466)
	at dotty.tools.dotc.transform.MegaPhase$MiniPhase.run(MegaPhase.scala:131)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:324)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:328)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:247)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:263)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:271)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:280)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:280)
	at dotty.tools.dotc.Run.compileSources(Run.scala:195)
	at dotty.tools.dotc.Run.compile(Run.scala:179)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	at dotty.tools.dotc.Driver.process(Driver.scala:195)
	at dotty.tools.dotc.Driver.process(Driver.scala:163)
	at dotty.tools.dotc.Driver.process(Driver.scala:175)
	at dotty.tools.dotc.Driver.main(Driver.scala:205)
	at dotty.tools.dotc.Main.main(Main.scala)
Compilation failed
@KacperFKorban KacperFKorban added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label regression This worked in a previous version but doesn't anymore area:linting Linting warnings enabled with -W or -Xlint and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 24, 2023
@Kordyjan Kordyjan removed the regression This worked in a previous version but doesn't anymore label Apr 25, 2023
@Kordyjan Kordyjan modified the milestones: 3.3.1-RC1, 3.3.0 backports Apr 25, 2023
@Kordyjan
Copy link
Contributor

This is not a regression, as -Wunused was not available earlier, but I still think it should be fixed asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug itype:crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants