Skip to content

Initialization-checker error is unhelpful for inlined functions #14467

@Xavientois

Description

@Xavientois

Compiler version

3.1.2-RC1

Minimized code

class InlineError {
  Assertion.failAssert(this)
  val v = 2;
}

object Assertion:
  transparent inline def failAssert(inline message: => Any): Unit =
    scala.runtime.Scala3RunTime.assertFailed(message)

Output

[error] -- Error: /*******/dotty/compiler/src/dotty/tools/dotc/InlineError.scala:10:45
[error] 10 |    scala.runtime.Scala3RunTime.assertFailed(message)
[error]    |                                             ^^^^^^^
[error]    |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments.

Expectation

I would expect a helpful error message that highlights what value is truly uninitialized (this in this case). However, when the call to the inlined method is in another file, there is no indication as to the source of the error. The only straightforward way to figure out the cause of the error is to make the method not inlined and try recompiling.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions