Skip to content

Crash when using an annotation in the file where it's defined #3506

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 Nov 20, 2017 · 2 comments
Closed

Crash when using an annotation in the file where it's defined #3506

helloqirun opened this issue Nov 20, 2017 · 2 comments

Comments

@helloqirun
Copy link

scalac can compile but dotc crashes.

Perhaps it's related to #1846. But I cannot reproduce that bug any more.

$ dotc -version

Dotty compiler version 0.5.0-bin-SNAPSHOT-git-4fefb64 -- Copyright 2002-2017, LAMP/EPFL

$ cat abc.scala

trait C2[@specialized A]
class specialized extends C2[Char]

$ dotc abc.scala

missing OriginalSymbol for List(type A, class C2, module class <empty>, module class <root>)

exception occurred while typechecking abc.scala

exception occurred while compiling abc.scala
Exception in thread "main" java.util.NoSuchElementException
	at dotty.tools.dotc.util.Attachment$LinkSource.attachment(Attachment.scala:28)
	at dotty.tools.dotc.typer.Typer.op$21(Typer.scala:1061)
	at dotty.tools.dotc.typer.Typer.typedTypeTree(Typer.scala:1056)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1662)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1690)
	at dotty.tools.dotc.typer.Typer.op$40(Typer.scala:1707)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1703)
<snipped>
@odersky
Copy link
Contributor

odersky commented Jan 2, 2018

This has to do with the fact that, due to early processing of annotations we cannot have the definition of an annotation in the same file as its use. It should not crash of course. But since we will want to revisit the decision to handle annotations early we should wait until that's settled.

@smarter smarter changed the title crash on compilable code: Exception in thread "main" java.util.NoSuchElementException Crash when using an annotation in the file where it's defined Jan 2, 2018
@smarter
Copy link
Member

smarter commented Jan 28, 2019

Already fixed, regression test in #5800.

@smarter smarter closed this as completed Jan 28, 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

4 participants