Skip to content

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

Closed
@liufengyun

Description

@liufengyun

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions