From b624dc868455558a2e57a4a76ad92e3ce1db2537 Mon Sep 17 00:00:00 2001 From: Hokeun Kim Date: Mon, 11 Jul 2022 15:15:54 -0700 Subject: [PATCH] Return -1 when the inference via connections fails. --- org.lflang/src/org/lflang/ASTUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/ASTUtils.java b/org.lflang/src/org/lflang/ASTUtils.java index a989a99f03..6f8ca4dbfa 100644 --- a/org.lflang/src/org/lflang/ASTUtils.java +++ b/org.lflang/src/org/lflang/ASTUtils.java @@ -1451,7 +1451,12 @@ public static int width(WidthSpec spec, List instantiations) { // If the width cannot be determined because term's width <= 0, which means the term's width // must be inferred, try to infer the width using connections. if (spec.eContainer() instanceof Instantiation) { - return inferWidthFromConnections(spec, instantiations); + try { + return inferWidthFromConnections(spec, instantiations); + } catch (InvalidSourceException e) { + // If the inference fails, return -1. + return -1; + } } } }