Skip to content

Type inference fails for singleton objects #1208

Closed
@scabug

Description

@scabug

The following fails with a type mismatch:

object Foo
val f: Option[Foo.type] = Some(Foo)

but succeeds with extra type annotation:

val f: Option[Foo.type] = Some[Foo.type](Foo)

This is annoying and I wish it were different :) Especially for the case with multiple type parameters, all of which can be inferred except for the singleton...

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