From 28364abd386761dfad37ce3be91703a5b2feaa5f Mon Sep 17 00:00:00 2001 From: Rainer Date: Tue, 18 Feb 2025 09:22:39 +0100 Subject: [PATCH] generate full AA typeinfo in InExp --- compiler/src/dmd/expressionsem.d | 5 ++++- compiler/test/runnable/testaa2.d | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/compiler/src/dmd/expressionsem.d b/compiler/src/dmd/expressionsem.d index f3a9809fa1..e325abfccd 100644 --- a/compiler/src/dmd/expressionsem.d +++ b/compiler/src/dmd/expressionsem.d @@ -13075,7 +13075,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor exp.e1 = exp.e1.implicitCastTo(sc, ta.index); } - semanticTypeInfo(sc, ta.index); + // even though the glue layer only needs the type info of the index, + // this might be the first time an AA literal is accessed, so check + // the full type info + semanticTypeInfo(sc, ta); // Return type is pointer to value exp.type = ta.nextOf().pointerTo(); diff --git a/compiler/test/runnable/testaa2.d b/compiler/test/runnable/testaa2.d index e33d47e002..e1abcb4418 100644 --- a/compiler/test/runnable/testaa2.d +++ b/compiler/test/runnable/testaa2.d @@ -299,6 +299,14 @@ void testinout() assert(b == 42); } +/************************************************/ +// type info generated for enum creation in InExp? +void testinenum() +{ + enum string[string] aa = [ "one" : "un", "two" : "deux" ]; + assert("one" in aa); +} + /************************************************/ int main() @@ -309,6 +317,7 @@ int main() test3825(); test3825x(); testinout(); + testinenum(); printf("Success\n"); return 0;