Scala 3 inline compilation error

import scala.compiletime.*, ops.string.*
import InlineCompilerError.*

object InlineCompilerError {
  inline def checkVersion[A <: Singleton & String](versionNo: A) =
    if constValue[Matches[versionNo.type, "\\d\\.\\d"]] then
      println(s"Correct version information")
    else
      error("Wrong version numbering! ")
}
@main def compilerErrorMain = checkVersion("1.2")
//@main def compilerErrorMain = checkVersion("1.x")

I haven’t followed developments too closely recently to explain why.

1 Like

@som-snytt OMG! So fast! Really appreciates such lightning answer. I posted this and was just trying to go through git comments and release notes and by the time you added the solution.
Amazing help! :slight_smile:

We both got lucky.

Thanks :slight_smile:
Just found out that, we dont need to add the type constraint. Just need to remove the inline from the param(versionNo).

inline def checkVersion(versionNo: String)

instead of

inline def checkVersion(inline versionNo: String)

Just read the description in the release note:

in the ( Known incompatibility: Stability of inline parameters) section

1 Like

Thanks! I have to catch up on my reading.