Skip to content

Strange program with incorrect type ascription compiles #10943

Closed
@LPTK

Description

@LPTK

Minimized code

object T:
  class A
  val a = new A : Int
end T

@main def m =
  println(T.a)

This is with options:

scalacOptions ++= Seq(
  "-deprecation",
  "-encoding", "UTF-8",
  "-feature",
  "-unchecked",
  "-Yindent-colons",
  "-Ykind-projector",
  "-language:strict",
  "-source:3.1",
)

https://scastie.scala-lang.org/R2s6G90oTQ2ZcE6dn4ZlPg

Output

T$A@5b61791c

Expectation

Should not compile.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions