-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Safe mode rejects unchecked annotations on synthetic symbols #25665
Copy link
Copy link
Open
Labels
area:experimental:safeIssues tied to scala.language.experimental.safe modeIssues tied to scala.language.experimental.safe modeitype:bug
Description
Compiler version
3.8.4-RC1-bin-20260331-724e9c3-NIGHTLY
3.nightly
Minimized code
Stest_1.scala
@caps.assumeSafe object A:
def f(
a: List[String] = List.empty,
b: Option[String] = None,
c: Long = 30000
) = ()Stest_2.scala
import language.experimental.safe
def test(i: Int) =
A.f(a = List("bar"), c = 1000)Compile: scala compile -S 3.nightly -experimental Stest_1.scala Stest_2.scala
The code is written in this way to:
- construct
uncheckedVarianceannotations on parameters; - force the desugar to lift the arguments.
Output
-- Error: Work/dotty/Stest_1.scala:116:26 ---------------------
116 | b: Option[String] = None,
| ^
|Cannot refer to class uncheckedVariance in package scala.annotation.unchecked from safe code since it is tagged @rejectSafe
1 error foundIt's also weird the error is on the first file, not on the synthesised symbol.
Expectation
Should compile
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:experimental:safeIssues tied to scala.language.experimental.safe modeIssues tied to scala.language.experimental.safe modeitype:bug