Skip to content

@experimental annotation doesn't work for inline functions #15133

Closed
@gregghz

Description

@gregghz

Compiler version

3.1.3-RC2

Minimized code

https://scastie.scala-lang.org/CCUeignRSJOnYEBa8aJTWg

import scala.annotation.experimental

@experimental
inline def foo: Any = ???

@experimental
object Test {
  @experimental val x = foo
  
  @experimental
  def bar() = {
    foo
  }
  
  foo
}

Output

[E] [E3] Foo.scala:15:3
[E]      method foo is marked @experimental and therefore may only be used in an experimental scope.
[E]      L15:   foo
[E]             ^^^
[E] [E2] Foo.scala:12:5
[E]      method foo is marked @experimental and therefore may only be used in an experimental scope.
[E]      L12:     foo
[E]               ^^^
[E] [E1] Foo.scala:8:25
[E]      method foo is marked @experimental and therefore may only be used in an experimental scope.
[E]      L8:   @experimental val x = foo
[E]                                  ^^^

Expectation

I expect all foo calls to be recognized as in the experimental scope.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions