aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-07-19 19:37:30 +0200
committerTristan Gingold <tgingold@free.fr>2021-07-19 19:37:30 +0200
commit22a721fabdf6643611d128328b49f38fcf0f6289 (patch)
tree0b6b216141b0b07d08cbc9dc23c16fb1ac7d0d29
parent9262a810e2536dd7786c198b0333f78ace96a3ef (diff)
downloadghdl-22a721fabdf6643611d128328b49f38fcf0f6289.tar.gz
ghdl-22a721fabdf6643611d128328b49f38fcf0f6289.tar.bz2
ghdl-22a721fabdf6643611d128328b49f38fcf0f6289.zip
vhdl-sem_assocs: improve handling of generic types
-rw-r--r--src/vhdl/vhdl-sem_assocs.adb38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/vhdl/vhdl-sem_assocs.adb b/src/vhdl/vhdl-sem_assocs.adb
index 62e9d0ca7..4c9ea3b06 100644
--- a/src/vhdl/vhdl-sem_assocs.adb
+++ b/src/vhdl/vhdl-sem_assocs.adb
@@ -1949,18 +1949,18 @@ package body Vhdl.Sem_Assocs is
-- If the formal type is an interface type of the same interface list,
-- use the associated type of the formal type to analyze the actual.
- if Get_Kind (Formal_Type) = Iir_Kind_Interface_Type_Definition then
- if Get_Parent (Get_Type_Declarator (Formal_Type)) = Get_Parent (Inter)
- then
- Formal_Type := Get_Associated_Type (Formal_Type);
- if Formal_Type = Null_Iir then
- -- Interface type are only allowed within generic map aspect,
- -- which are analyzed in one step (so Finish is true).
- pragma Assert (Finish);
- Error_Msg_Sem (+Assoc, "expression associated before its type");
- Match := Not_Compatible;
- return;
- end if;
+ if Get_Kind (Formal_Type) = Iir_Kind_Interface_Type_Definition
+ and then (Get_Parent (Get_Type_Declarator (Formal_Type))
+ = Get_Parent (Inter))
+ then
+ Formal_Type := Get_Associated_Type (Formal_Type);
+ if Formal_Type = Null_Iir then
+ -- Interface type are only allowed within generic map aspect,
+ -- which are analyzed in one step (so Finish is true).
+ pragma Assert (Finish);
+ Error_Msg_Sem (+Assoc, "expression associated before its type");
+ Match := Not_Compatible;
+ return;
end if;
end if;
@@ -2281,6 +2281,15 @@ package body Vhdl.Sem_Assocs is
First_Named_Assoc := Null_Iir;
Has_Individual := False;
+ -- Clear associated type of interface type.
+ Inter := Interface_Chain;
+ while Inter /= Null_Iir loop
+ if Get_Kind (Inter) = Iir_Kind_Interface_Type_Declaration then
+ Set_Associated_Type (Get_Type (Inter), Null_Iir);
+ end if;
+ Inter := Get_Chain (Inter);
+ end loop;
+
-- Loop on every assoc element, try to match it.
Inter := Interface_Chain;
Last_Individual := Null_Iir;
@@ -2680,11 +2689,6 @@ package body Vhdl.Sem_Assocs is
end if;
end if;
- -- Clear associated type of interface type.
- if Get_Kind (Inter) = Iir_Kind_Interface_Type_Declaration then
- Set_Associated_Type (Get_Type (Inter), Null_Iir);
- end if;
-
Inter := Get_Chain (Inter);
Pos := Pos + 1;
end loop;