Skip to content

Passing Type[T] implicit argument where T <: AnyRef gives Dotty internal error #6263

Closed
@fhackett

Description

@fhackett
import quoted._

def fn[T : Type](v : T) = ???

Calling:

> fn("foo")
> fn((1,2))
> object O
  fn(O)

etc... (likely for any Ref type)

Give the following error:

java.lang.Error: Internal error: this method call should have been replaced by the compiler
        at scala.internal.Quoted$.typeQuote(Quoted.scala:17)
        at rs$line$5$.<init>(rs$line$5:1)
        at rs$line$5$.<clinit>(rs$line$5)
        at rs$line$5.res1(rs$line$5)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at dotty.tools.repl.Rendering.$anonfun$3(Rendering.scala:57)
        at scala.Option.map(Option.scala:163)
...

Calling foo(1), foo('1') (it seems for any Val type) instead gives the expected "missing implementation" error.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions