-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:annotationsarea:desugarDesugaring happens after parsing but before typing, see desugar.scalaDesugaring happens after parsing but before typing, see desugar.scalaitype:enhancement
Description
Compiler version
3.7.3
Minimized code
➜ cat something-else.scala
import annotation.*
package p:
package q:
@targetName("mypq")
object `package`:
private[p] def f = 42Output
➜ scala-cli compile --server=false -S 3.7.3 something-else.scala
-- [E169] Syntax Error: /home/amarki/snips/something-else.scala:7:12 -----------
7 | object `package`:
| ^
| @targetName annotation not allowed on top-level package object q
|
| longer explanation available when compiling with `-explain`
1 error found
Compilation failedExpectation
Since the file name, and therefore the package object name, is arbitrary and may require special encoding, I would like to "fix" the name to something benign (instead of something-else).
Packages don't take annotations, but object syntax does, and possibly package object syntax could be made to.
It would be nice if targetName were permitted for package objects.
Metadata
Metadata
Assignees
Labels
area:annotationsarea:desugarDesugaring happens after parsing but before typing, see desugar.scalaDesugaring happens after parsing but before typing, see desugar.scalaitype:enhancement