Skip to content

Incorrect return value from typeChecks with inline value #7487

@adamgfraser

Description

@adamgfraser

minimized code

import scala.compiletime.testing.typeChecks

object Minimized extends App {
  inline val code = "1 + 1"
  val result1: Boolean = typeChecks(code)    // false
  val result2: Boolean = typeChecks("1 + 1") // true
  println(result1)
  println(result2)
}

expectation

I would have expected that as long as code was marked as inline, typeChecks would evaluate a string value the same as if I included that string directly in the function body.

Also, I noticed that result1 requires a type annotation to compile. I'm not sure why that should be necessary given typeChecks always returns a Boolean.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions