Skip to content

Inference of Dependent Function Types gives "Unspecified Error" #5526

Closed
@b-studios

Description

@b-studios

The following code example leads to an "unspecified error":

trait A
  
def foo[E](f: (a: A) => (a.type, E)): E = {
  val a = new A {}
  f(a)._2
}

foo { a => (a, ()) }

It does type check when annotating the call to foo:

foo[Unit] { a => (a, ()) }

Also, removing the dependent function type from foo does typecheck:

def foo[E](f: (a: A) => (A, E)): E 

This might be related to #4130, but extracted to a separate issue since it might be fixable, independently.

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