Skip to content

strict equality + explicit nulls = paradox #11469

Open
@megri

Description

@megri

Compiler version

3.0.0-RC1

Compiler settings

flags: -Yexplicit-nulls + -language:strictEquality

Minimized code

def couldBeNull: String|Null =if couldBeNull == null then -1 else couldBeNull.length 

Output

-- Error: <redacted>/app.scala:16:7
16 |    if couldBeNull == null then -1 else couldBeNull.length
   |       ^^^^^^^^^^^^^^^^^^^
   | Values of types Null | String and Null cannot be compared with == or !=
one error found
one error found

Expectation

no error found

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions