Add typed data contract editing and bounded dictionary views
This commit is contained in:
@@ -157,12 +157,9 @@ pub fn port_context_rows(project: &Project, port: Id) -> Vec<String> {
|
||||
}
|
||||
if let Some(legacy) = legacy {
|
||||
rows.push(legacy_line(&context, legacy));
|
||||
if let Some(interface) = legacy.interface
|
||||
&& let Some(SharedBody::Interface { items }) =
|
||||
context.element(interface).and_then(Element::shared)
|
||||
{
|
||||
for item in items {
|
||||
origins.entry(*item).or_default().push(format!(
|
||||
if let Some(interface) = legacy.interface {
|
||||
for item in data::interface_items(project, interface) {
|
||||
origins.entry(item).or_default().push(format!(
|
||||
"preserved interface {} (suggestion only; not an active typed contract)",
|
||||
context.label(interface)
|
||||
));
|
||||
@@ -711,11 +708,17 @@ mod tests {
|
||||
let (other_fe, commands) = exchange(&mut project, source, target, vec![second]);
|
||||
project = execute_batch(&project, &commands).unwrap();
|
||||
let interface = add(&mut project, Kind::Interface, "Incident service");
|
||||
project.elements.get_mut(&interface).unwrap().body = ElementBody::shared_in(
|
||||
Layer::Sa,
|
||||
SharedBody::Interface {
|
||||
items: vec![first, second],
|
||||
},
|
||||
project.relate(
|
||||
RelationKind::InterfaceItemAllocation,
|
||||
"First item",
|
||||
interface,
|
||||
first,
|
||||
);
|
||||
project.relate(
|
||||
RelationKind::InterfaceItemAllocation,
|
||||
"Second item",
|
||||
interface,
|
||||
second,
|
||||
);
|
||||
let connection = &project.relations[&boundary];
|
||||
let (a, b) = (connection.source(), connection.target());
|
||||
@@ -790,8 +793,12 @@ mod tests {
|
||||
..
|
||||
} = fixture();
|
||||
let interface = add(&mut project, Kind::Interface, "Preserved contract");
|
||||
project.elements.get_mut(&interface).unwrap().body =
|
||||
ElementBody::shared_in(Layer::Sa, SharedBody::Interface { items: vec![first] });
|
||||
project.relate(
|
||||
RelationKind::InterfaceItemAllocation,
|
||||
"Allocated item",
|
||||
interface,
|
||||
first,
|
||||
);
|
||||
let legacy = port(
|
||||
&mut project,
|
||||
source,
|
||||
|
||||
Reference in New Issue
Block a user