Skip to content

Compiler failed to synthesize Type[T] for local type alias T #6588

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
liufengyun opened this issue May 30, 2019 · 0 comments
Closed

Compiler failed to synthesize Type[T] for local type alias T #6588

liufengyun opened this issue May 30, 2019 · 0 comments

Comments

@liufengyun
Copy link
Contributor

liufengyun commented May 30, 2019

Discovered in #6586, the following code fails to compile:

import scala.quoted._

inline def foo[T:Type]: Int = 10

def main = {
  type S = Int
  foo[S]                 // ok
  foo[Int]               // ok

  type T = Int => Int
  foo[T]                 // error
  foo[Int => Int]        // ok

  type U = List[Int]
  foo[U]                // error
  foo[List[Int]]        // ok

  type N = List
  foo[N]               // error
  foo[List]            // ok
}
-- Error: examples/test.scala:11:8 ---------------------------------------------
11 |  foo[T]                 // error
   |        ^
   |no implicit argument of type quoted.Type[T] was found for parameter evidence$1 of method foo
-- Error: examples/test.scala:15:8 ---------------------------------------------
15 |  foo[U]                // error
   |        ^
   |no implicit argument of type quoted.Type[U] was found for parameter evidence$1 of method foo
-- Error: examples/test.scala:19:8 ---------------------------------------------
19 |  foo[N]               // error
   |        ^
   |no implicit argument of type quoted.Type[N] was found for parameter evidence$1 of method foo
@liufengyun liufengyun self-assigned this May 30, 2019
liufengyun added a commit to dotty-staging/dotty that referenced this issue May 30, 2019
For the test case `tests/pos/i4514.scala`, previously the generated
evidence is incorrect, as the following code shows:

    inline def foo[X >: Nothing <: Any](x: X): Unit =
      ${Foo.fooImpl[quoted.Expr[X]]('{x})('[quoted.Expr[X]])}:Unit
liufengyun added a commit to dotty-staging/dotty that referenced this issue May 30, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 4, 2019
nicolasstucki added a commit that referenced this issue Jun 5, 2019
Fix #6588: Dealias inferred quoted types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants