8000 Type Mismatch Error for the same type · Issue #26 · arainko/ducktape · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Type Mismatch Error for the same type #26
Closed
@LightSystem

Description

@LightSystem

Hi @arainko,
First of all thank you for this awesome library! It is a godsend that is helping us migrate to Scala 3 in a more painless manner 😌

I've just started using it for some of our case class transformations and have encountered a curious issue. Seems to have to do with companion objects or objects in general.
Let's imagine I have these case classes:

case class A(anotherCaseClass: AnotherCaseClass)
object A:
  case class AnotherCaseClass(name: String)
  case class B(anotherCaseClass: AnotherCaseClass)

AnotherCaseClass can be simple or complex, it doesn't matter. If I then do:

val a = A(AnotherCaseClass("test"))
a.to[B]

I get the following compilation error:

[error] -- [E007] Type Mismatch Error: /some/file:95:11 
[error] 95 |    a.to[B]
[error]    |           ^
[error]    |           Found:    A.AnotherCaseClass | dest
[error]    |           Required: A.AnotherCaseClass
[error]    |----------------------------------------------------------------------------
[error]    |Inline stack trace
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from LiftTransformationModule.scala:15
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from LiftTransformationModule.scala:15
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from LiftTransformationModule.scala:15

I'm using scala 3.2.1 and ducktape version 0.1.1.

Thanks again. If I get some time I'll try to research this problem deeper by looking into ducktape's codebase though metaprogramming is something I'm not very familiar with yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0