Skip to content

Regression on path dependent types from 3.2 #21536

Closed as not planned
Closed as not planned
@AnnelineD

Description

@AnnelineD

Compiler version

Works on 3.2.2 and fails on 3.3.2 and 3.5.0.

Minimized code

object PatchG:
   inline def apply[EL, MG <: DNIELMG[EL]](inline mg: MG)(inline ptps: List[(mg.Node | C.type, mg.Node | C.type)]): PatchG[EL, MG]

https://github.com/Adam-Vandervorst/LLGraph/blob/10f010e536beb1c8fb5f5a8bf80f7c308dc72768/src/main/scala/be.adamv.llgraph/graphs/PatchG.scala#L112

Output

[error] -- [E083] Type Error: /home/anneline/IdeaProjects/LLGraph/src/main/scala/be.adamv.llgraph/graphs/PatchG.scala:112:76 
[error] 112 |  inline def apply[EL, MG <: DNIELMG[EL]](inline mg: MG)(inline ptps: List[(mg.Node | C.type, mg.Node | C.type)]): PatchG[EL, MG] =
[error]     |                                                                            ^^
[error]     |(mg : MG) is not a valid type prefix, since it is not an immutable path
[error]     |---------------------------------------------------------------------------
[error]     | Explanation (enabled by `-explain`)
[error]     |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]     | An immutable path is
[error]     |  - a reference to an immutable value, or
[error]     |  - a reference to `this`, or
[error]     |  - a selection of an immutable path with an immutable value.
[error]      ---------------------------------------------------------------------------

Expectation

To compile, since the inlined version does type-check.
Example usage:

  val rhs = DNIELMG[Char]()
  val r = rhs.newNodes(2)
  rhs.connect(r(0), r(0), 'b')

  val rpg = PatchG[Char, rhs.type](rhs)(List(C -> r(0), r(1) -> C))

https://github.com/Adam-Vandervorst/LLGraph/blob/10f010e536beb1c8fb5f5a8bf80f7c308dc72768/src/test/scala/PatchGTest.scala#L24

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