Skip to content

Regression macro matching with Varargs fails: Sequence argument type annotation * cannot be used here #19709

Closed
@hmf

Description

@hmf

Compiler version

Was working with version 3.2.2. Now fails with 3.3.1. Basis for is code was the example in this page.

EDIT: This seems to be working in 3.3.0.

Minimized code

        case '{ List[String].apply(${Varargs(Exprs(elems))}: _*) } =>  
          Some(elems.toList.asInstanceOf[List[T]])

Output

error] -- [E178] Type Error: /home/hmf/VSCodeProjects/sploty/meta/src/icollection/IMap.scala:1753:20 
[error] 1753 |        case '{ List[String].apply(${Varargs(Exprs(elems))}: _*) } =>  
[error]      |                ^^^^^^^^^^^^
[error]      |     missing argument list for method apply in trait IterableFactory
[error]      |
[error]      |       def apply[A](elems: A*): CC[A]
[error]      |--------------------------------------------------------------------------
[error]      | Explanation (enabled by `-explain`)
[error]      |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]      | Unapplied methods are only converted to functions when a function type is expected.
[error]       --------------------------------------------------------------------------
[error] Explanation
[error] ===========
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] -- Error: /home/hmf/VSCodeProjects/sploty/meta/src/icollection/IMap.scala:1753:35 
[error] 1753 |        case '{ List[String].apply(${Varargs(Exprs(elems))}: _*) } =>  
[error]      |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]      |Sequence argument type annotation `*` cannot be used here:
[error]      |the corresponding parameter has type Int which is not a repeated parameter type
[error] -- [E006] Not Found Error: /home/hmf/VSCodeProjects/sploty/meta/src/icollection/IMap.scala:1755:15 
[error] 1755 |          Some(elems.toList.asInstanceOf[List[T]])
[error]      |               ^^^^^
[error]      |               Not found: elems
[error]      |--------------------------------------------------------------------------
[error]      | Explanation (enabled by `-explain`)
[error]      |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]      | The identifier for `elems` is not bound, that is,
[error]      | no declaration for this identifier can be found.
[error]      | That can happen, for example, if `elems` or its declaration has either been
[error]      | misspelt or if an import is missing.
[error]       --------------------------------------------------------------------------
[error] Explanation
[error] ===========
[error] The identifier for `elems` is not bound, that is,
[error] no declaration for this identifier can be found.
[error] That can happen, for example, if `elems` or its declaration has either been
[error] misspelt or if an import is missing.

Expectation

Was hoping no changes were needed for the upgrade.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions