Skip to content

Names of vals or vars may not end in _=, said scalac. #9023

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
som-snytt opened this issue May 22, 2020 · 1 comment · Fixed by #9025
Closed

Names of vals or vars may not end in _=, said scalac. #9023

som-snytt opened this issue May 22, 2020 · 1 comment · Fixed by #9025

Comments

@som-snytt
Copy link
Contributor

Minimized code

class C:
  var __= : Int = 42      // or similar val x_=

Output (click arrow to expand)

exception occurred while compiling badvar.scala
java.util.NoSuchElementException: head of empty list while compiling badvar.scala
Exception in thread "main" java.util.NoSuchElementException: head of empty list
	at scala.collection.immutable.Nil$.head(List.scala:629)
	at scala.collection.immutable.Nil$.head(List.scala:628)
	at dotty.tools.dotc.transform.Memoize.newField$1(Memoize.scala:78)
	at dotty.tools.dotc.transform.Memoize.$anonfun$1(Memoize.scala:118)
	at dotty.tools.dotc.core.Symbols$Symbol.orElse(Symbols.scala:617)
	at dotty.tools.dotc.transform.Memoize.transformDefDef(Memoize.scala:118)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:941)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:942)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:942)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:248)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:404)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:409)
	at scala.collection.immutable.List.mapConserve(List.scala:472)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:339)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:404)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:409)
	at scala.collection.immutable.List.mapConserve(List.scala:472)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:356)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:359)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:415)
	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:427)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:318)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:319)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:165)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:175)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:183)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:190)
	at dotty.tools.dotc.Run.compileSources(Run.scala:127)
	at dotty.tools.dotc.Run.compile(Run.scala:110)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:194)
	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:202)
	at dotty.tools.dotc.Main.main(Main.scala)
@som-snytt
Copy link
Contributor Author

What's missing is Dotty merchandise that says MegaPhase.

A t-shirt with a comics panel in which our hero, faced with an overwhelming alien force, cries out in a speech balloon: transform.MegaPhase! to activate their superpowers.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 22, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 22, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 25, 2020
smarter added a commit that referenced this issue May 25, 2020
Fix #9023: Check that names of vals and vars do not end with `_=`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant