Skip to content

unhelpful error message for ValueOf[N] when no singleton available for N (bounded by singleton) #15829

@cayhorstmann

Description

@cayhorstmann

Compiler version

3.2.0-RC1

Minimized code

import scala.compiletime.*

class Vec[N <: Int & Singleton] :
  private val xs: Array[Double] = Array.ofDim[Double](summon[ValueOf[N]].value)

Output

No singleton value available for N.

Expectation

My expectation is that the Singleton bound makes ValueOf realize that N is a singleton. But I am no expert, and the fact that #8257 was closed makes me wonder. But then my expectation would be to get an error message that is clearer.

A bit more detail at https://users.scala-lang.org/t/how-do-i-compute-type-level-m-n/8715/2

Metadata

Metadata

Assignees

Labels

area:reportingError reporting including formatting, implicit suggestions, etcitype:enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions