Skip to content

Unable to locate class corresponding to inner class entry for Edge$ in owner scalax.collection.GraphBase when compiling with "-Yinline" #77

Description

@manuzhang

Reproducible with the following codes,

import scalax.collection.mutable.{Graph => SGraph}
import scalax.collection.edge.LDiEdge

class Graph[N, E](private val graph: SGraph[N, LDiEdge]) extends Serializable {

  def addVertex(vertex: N): Unit = {
    graph.add(vertex)
  }

  def addEdge(s: N, e: E, t: N): Unit = {
    implicit val edgeCompanion = LDiEdge
    graph.addLEdge(s, t)(e)
  }

  /**
   * ====== ERROR ======
   * Unable to locate class corresponding to inner class entry for Edge$
   * in owner scalax.collection.GraphBase
   */
  private def toEdge(e: graph.EdgeT): (N, E, N) = {
    (e.source, e.label.asInstanceOf[E], e.target)
  }

  /**
   * Map a graph to a new graph, with edge converted to new type
   * Current graph is not changed.
   */
  def mapEdge[NewEdge](fun: (N, E, N) => NewEdge): Graph[N, NewEdge] = {
    val newGraph = new Graph[N, NewEdge](SGraph.empty[N, LDiEdge])
    graph.foreach {
      case n: graph.NodeT => newGraph.addVertex(n.value)
      case e: graph.EdgeT =>
        val (s, p, t) = toEdge(e)
        newGraph.addEdge(s, fun(s, p, t), t)
    }
    newGraph
  }
}

sbt build file

name := "scala-graph-example"

version := "1.0"

scalaVersion := "2.11.8"

libraryDependencies += "org.scala-graph" %% "graph-core" % "1.11.5"

scalacOptions ++= Seq("-Yinline")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions