Skip to content

ClassCastException: _* is not a term name #5035

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
sir-wabbit opened this issue Aug 26, 2018 · 2 comments
Closed

ClassCastException: _* is not a term name #5035

sir-wabbit opened this issue Aug 26, 2018 · 2 comments

Comments

@sir-wabbit
Copy link

class i0{val(_* @}

somehow error-recovers into

class i0 {
  val (_* @ null) = null
}

which fails with

Exception in thread "main" java.lang.ClassCastException: _* is not a term name
	at dotty.tools.dotc.core.Names$TypeName.asTermName(Names.scala:443)
	at dotty.tools.dotc.ast.desugar$.derivedValDef(Desugar.scala:898)
	at dotty.tools.dotc.ast.desugar$.makePatDef(Desugar.scala:747)
	at dotty.tools.dotc.ast.desugar$.patDef$$anonfun$2(Desugar.scala:709)
	at scala.collection.immutable.List.map(List.scala:283)
	at dotty.tools.dotc.ast.desugar$.patDef(Desugar.scala:709)
	at dotty.tools.dotc.ast.desugar$.defTree(Desugar.scala:778)
	at dotty.tools.dotc.typer.Namer.expand(Namer.scala:419)
	at dotty.tools.dotc.typer.Namer.index$$anonfun$1(Namer.scala:683)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at dotty.tools.dotc.typer.Namer.index(Namer.scala:683)
	at dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:939)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:746)

CCE-3f31ba00cea30842028ab580e5be0270046c682d

@sir-wabbit
Copy link
Author

class i0{
var i0==_*
}

error-recovers into (-Xprint:parser)

class i0 { 
  val i0 == _* = null
}

which dies with

Exception in thread "main" java.lang.ClassCastException: _* is not a term name
	at dotty.tools.dotc.core.Names$TypeName.asTermName(Names.scala:443)
	at dotty.tools.dotc.ast.desugar$.derivedValDef(Desugar.scala:898)
	at dotty.tools.dotc.ast.desugar$.$anonfun$23(Desugar.scala:760)
	at scala.collection.TraversableLike$WithFilter.$anonfun$map$2(TraversableLike.scala:739)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:738)
	at dotty.tools.dotc.ast.desugar$.makePatDef(Desugar.scala:760)
	at dotty.tools.dotc.ast.desugar$.patDef$$anonfun$2(Desugar.scala:709)
	at scala.collection.immutable.List.map(List.scala:283)
	at dotty.tools.dotc.ast.desugar$.patDef(Desugar.scala:709)
	at dotty.tools.dotc.ast.desugar$.defTree(Desugar.scala:778)
	at dotty.tools.dotc.typer.Namer.expand(Namer.scala:419)
	at dotty.tools.dotc.typer.Namer.index$$anonfun$1(Namer.scala:683)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at dotty.tools.dotc.typer.Namer.index(Namer.scala:683)
	at dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:939)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:746)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:237)

CCE-aafcaa9cd2611d22f63273738d637f5bec6e7152

smarter added a commit to dotty-staging/dotty that referenced this issue Apr 30, 2019
@odersky odersky closed this as completed in 6491b48 May 2, 2019
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

3 participants