Skip to content

Commit

Permalink
Validate implementing self when extending
Browse files Browse the repository at this point in the history
  • Loading branch information
filosganga committed Mar 29, 2023
1 parent 100a8d4 commit 61a2631
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,14 @@ class AstSchemaMaterializer[Ctx] private (
extensions: Vector[ast.InterfaceTypeExtensionDefinition]): List[InterfaceType[Ctx, Any]] = {
val extraInts = extensions.flatMap(_.interfaces)

// Validate for implementing self
extraInts.foreach { i =>
if (i.name == tpe.name)
throw MaterializedSchemaValidationError(
Vector(ImplementSelfViolation(tpe.name, document.sourceMapper, i.location.toList))
)
}

val ei = extraInts.map(getInterfaceType(origin, _))
val oi = tpe.interfaces.map(getTypeFromDef(origin, _).asInstanceOf[InterfaceType[Ctx, Any]])

Expand Down

0 comments on commit 61a2631

Please sign in to comment.