Skip to content

Quotes#PolyType type-tests as Quotes#TypeLambda #16961

Closed
@pweisenburger

Description

@pweisenburger

Compiler version

3.3.1-RC1-bin-20230216-2507577-NIGHTLY

Minimized example

import scala.quoted.*

inline def test = ${ testImpl }

def testImpl(using Quotes) =
  import quotes.reflect.*

  PolyType(List("arg"))(_ => List(TypeBounds.empty), _ => TypeRepr.of[Any]) match
    case _: TypeLambda => println("is a TypeLambda")
    case _ => println("is not a TypeLambda")

  '{ () }

Output

When expanding, the macro prints is a TypeLambda

Expectation

The documentation shows the type hierarchy:

             +
             +- LambdaType -+- MethodOrPoly -+- MethodType
             |              |                +- PolyType
             |              +- TypeLambda
             +

Based on this, I would expect the output to be is not a TypeLambda. Of course, it could be that the run time type of what PolyType generates is a subtype of both PolyType and TypeLambda, but given the documentation I find this behavior at least unexpected. I suppose that the type test and the documentation should be aligned.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions