Skip to content

Conversation

@Kronos3
Copy link
Collaborator

@Kronos3 Kronos3 commented Oct 22, 2025

This PR implements topology port semantics according to the spec from #748

Interesting Changes

  • Topology uses and component instance uses were merged into a single interfaceInstanceUse
  • The component's portMap + specialPortMap were moved out into a separate PortInterface construct so that it could be reused inside topology
  • A new port instance case class was added PortInstance.Topology for wrapping ports with a new name to impement topology ports.
  • SpecLoc.Instance (was for component instance) and SpecLoc.Topology was merged into SpecLoc.Instance (interface instance). (This required a spec update).

Closes #745

@Kronos3 Kronos3 marked this pull request as ready for review October 23, 2025 04:51
@Kronos3 Kronos3 requested a review from bocchino October 30, 2025 17:30
override def getUnqualifiedName = node._2.data.name
}

type InterfaceInstance = Symbol.ComponentInstance | Symbol.Topology
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, for consistency, let's make InterfaceInstance a sealed trait if possible.

c.out -> c.in
^
error: out is not a port instance of component C
error: out is not a port instance of interface c
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Should this error message say interface instance c?
  2. Can we provide a note here saying that c has type C? Otherwise there is a small regression in the quality of the error output.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general for this kind of error, c has to be a topology T, a component instance with component type C, or an interface parameter with interface I, right? Could the error message say "... is not a port instance of topology T/component C/interface I"? That would be clearer and would preserve what we had before.

^
error: symbol c is not defined
note: looking for a component instance here
note: looking for a port interface instance here
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this error message say "looking for a component instance, topology, or interface parameter here"? I think that would be clearer.

match p1 with p2
^
error: p2 is not a port instance of component C
error: p2 is not a port instance of interface C
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change to the error message doesn't look right. A matching specifier occurs in a component definition, not an interface definition.

loc: Location // The location whether the connection is requested
): Result.Result[Unit] = Right(())

override def equals(obj: Any): Boolean =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to override equals here? What happens if we use the default equals?

Copy link
Collaborator

@bocchino bocchino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I just have a few comments/questions about error messages and coding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants