Skip to content

The union type of any pair of singleton types is equivalent to their supertype #829

Closed
@propensive

Description

@propensive

There are a couple of ways of demonstrating this. The following does not produce a type error when it should:

def foo: 1 | 2 = 1
def bar: 3 | 4 = foo

whereas this does (correctly):

def foo: 1 | 2 = 1
def bar: 1 = foo

Intersection types do, however, appear to work correctly. This produces the expected type error:

trait X {
  def foo: 1 & 2
  def bar: 2 & 3 = foo
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions