Skip to content

Given instances, their extension methods with implicits, match types with type extractors – compile error #7087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anatoliykmetyuk opened this issue Aug 22, 2019 · 1 comment

Comments

@anatoliykmetyuk
Copy link
Contributor

anatoliykmetyuk commented Aug 22, 2019

type Foo

type G[A]

type F[T] = T match {
  case G[a] => String
}

given A {
  def (tup: T) g[T] given Foo: F[T] = ???
}

def f(x: G[Int]) given Foo: String = x.g

Out:

-- [E008] Member Not Found Error: ../pg/Macros3.scala:13:39 --------------------
13 |def f(x: G[Int]) given Foo: String = x.g
   |                                     ^^^
   |      value g is not a member of G[Int] - did you mean x.==?.
   |      An extension method was tried, but could not be fully constructed:
   |
   |          Macros3$package.A.g[T](x)
one error found
Working examples
type Foo

type G[A]

type F[T] = T match {
  case G[a] => String
}

// given A {
  def (tup: T) g[T] given Foo: F[T] = ???
// }

def f(x: G[Int]) given Foo: String = x.g
type Foo

type G[A]

type F[T] = T match {
  case G[a] => String
}

given A {
  def (tup: T) g[T]/* given Foo*/: F[T] = ???
}

def f(x: G[Int]) given Foo: String = x.g
type Foo

type G[A]

type F[T] = T match {
  case G[a] => String
}

given A {
  def (tup: T) g[T] given Foo: F[T] = ???
}

def f(x: G[Int]) given Foo/*: String*/ = x.g
type Foo

type G[A]

type F[T] = T match {
  case /*G[Int]*/Any => String
}

given A {
  def (tup: T) g[T] given Foo: F[T] = ???
}

def f(x: G[Int]) given Foo: String = x.g

Possibly related to #7084.

@odersky
Copy link
Contributor

odersky commented Aug 24, 2019

Seems to be a duplicate of #7084. It's fixed by #7093.

@odersky odersky closed this as completed Aug 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants