Skip to content

The code in the "Unsoundness" subsection of the "Explicit Nulls" page doesn't compile #7881

Closed
@ShapelessCat

Description

@ShapelessCat

The provided code doesn't compile when there is a -Yexplicit-nulls flag.
With explicit nulls, we can't compile code like stringValue == null, which is mentioned in the subsection "Equality" that just after the "Unsoundness" subsection.

I think this piece of code can be corrected and simplified as

class C {
  val f: String = foo(f)
  def foo(f2: String): String = f2

val c = new C()
// c.f is null

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions