Skip to content

Commit c35f94d

Browse files
committed
in scala 3.3.3 we can still use a more precise type in the subclass
1 parent 47de500 commit c35f94d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

codegen/src/main/scala/overflowdb/codegen/CodeGen.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class CodeGen(schema: Schema) {
525525
// val relevantNeighbors = (neighbors ++ subtypesWithSameEdgeAndDirection).map(_.neighbor).toSet
526526
// deriveCommonRootType(relevantNeighbors)
527527
// }
528-
val neighborNodesType = "StoredNode"
528+
val neighborNodesType = "? <: StoredNode"
529529
val genericEdgeAccessor = s"def $edgeAccessorName: Iterator[$neighborNodesType]"
530530

531531
val specificNodeAccessors = neighbors.flatMap { adjacentNode =>
@@ -1011,8 +1011,7 @@ class CodeGen(schema: Schema) {
10111011
}.mkString(lineSeparator)
10121012

10131013
val neighborNodeClass = neighborInfo.deriveNeighborNodeType.getOrElse(schema.anyNode).className
1014-
s"""/** Actually this Iterator includes only `$neighborNodeClass` nodes, but we need to stick to the inherited type from BaseNode */
1015-
|def $edgeAccessorName: Iterator[StoredNode] = get().$edgeAccessorName
1014+
s"""def $edgeAccessorName: Iterator[$neighborNodeClass] = get().$edgeAccessorName
10161015
|override def _$edgeAccessorName = get()._$edgeAccessorName
10171016
|
10181017
|$nodeDelegators

0 commit comments

Comments
 (0)