Skip to content

crash with "java.lang.IllegalArgumentException: requirement failed" #1647

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
helloqirun opened this issue Oct 31, 2016 · 2 comments
Closed

Comments

@helloqirun
Copy link

$ cat abc.scala

class ann {
  @ann({ def baz })
  def foo()
}

$ dotc abc.scala

-- [E018] Syntax Error: abc.scala --------------------------------------------------------------------------------------
3 |  @ann({ def baz })
  |                ^
  |                missing return type

longer explanation available when compiling with `-explain`
-- [E018] Syntax Error: abc.scala --------------------------------------------------------------------------------------
4 |  def foo()
  |           ^
  |           missing return type

longer explanation available when compiling with `-explain`

exception occurred while typechecking abc.scala

exception occurred while compiling abc.scala
Exception in thread "main" java.lang.IllegalArgumentException: requirement failed
	at scala.Predef$.require(Predef.scala:207)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.enterNoReplace(SymDenotations.scala:1548)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.enter(SymDenotations.scala:1538)
	at dotty.tools.dotc.typer.NamerContextOps$class.enter(Namer.scala:34)
	at dotty.tools.dotc.core.Contexts$Context.enter(Contexts.scala:57)
	at dotty.tools.dotc.typer.Namer.enterSymbol(Namer.scala:334)
	at dotty.tools.dotc.typer.Namer.dotty$tools$dotc$typer$Namer$$recur$1(Namer.scala:417)
	at dotty.tools.dotc.typer.Namer.indexExpanded(Namer.scala:427)
<snipped>
@liufengyun
Copy link
Contributor

Report confirmed, thanks @helloqirun !

@odersky
Copy link
Contributor

odersky commented Nov 5, 2016

This has to do with the fact that the annotation argument is typed with the enclosing class as owner, whereas the owner should be the localDummy of the template. Does not look so easy to fix though.

odersky referenced this issue Nov 10, 2016
Use inline flag instead of @inline annotation
odersky added a commit to dotty-staging/dotty that referenced this issue Nov 10, 2016
Need to evaluate annotation arguments in an expression context, since
classes defined in asuch arguments should not be entered into enclosing
class.

Fixes scala#1647
@odersky odersky self-assigned this Nov 10, 2016
odersky added a commit to dotty-staging/dotty that referenced this issue Nov 24, 2016
Need to evaluate annotation arguments in an expression context, since
classes defined in asuch arguments should not be entered into enclosing
class.

Fixes scala#1647
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 1, 2016
Need to evaluate annotation arguments in an expression context, since
classes defined in asuch arguments should not be entered into enclosing
class.

Fixes scala#1647
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