Skip to content

int/long literal type conforms to float/double literal type with different value via type alias #18340

Closed
@unkarjedy

Description

@unkarjedy

Compiler version

Scala 3.3.1-RC4

Minimized code

@main def main: Unit =
  type T = 3f
  val value1: T = -100500 //BAD: compiler doesn't report an error
  val value2: T = -100500L //BAD: compiler doesn't report an error
  //val value3: T = -100500D //OK: compiler error
  //val value4: T = true //OK: compiler error

Expectation

The code shouldn't compile

The same issue for type T = 3d

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions