From 6a7d3b88429c8bef600c346ec2f5d78e657b0ff6 Mon Sep 17 00:00:00 2001 From: bangbangsheshotmedown Date: Fri, 6 Mar 2026 12:44:44 +0100 Subject: [PATCH] Skip static fields when building ctor --- dsymbol/src/dsymbol/conversion/first.d | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/dsymbol/src/dsymbol/conversion/first.d b/dsymbol/src/dsymbol/conversion/first.d index 6cad7ff8..ec2e6d69 100644 --- a/dsymbol/src/dsymbol/conversion/first.d +++ b/dsymbol/src/dsymbol/conversion/first.d @@ -255,8 +255,12 @@ final class FirstPass : ASTVisitor currentSymbol.addChild(symbol, true); currentScope.addSymbol(symbol.acSymbol, false); - if (currentSymbol.acSymbol.kind == CompletionKind.structName - || currentSymbol.acSymbol.kind == CompletionKind.unionName) + // Skip static fields (not instance members) + import std.algorithm : any; + if (!dec.storageClasses.any!(sc => + sc.token.type == tok!"static" || + sc.token.type == tok!"enum" || + sc.token.type == tok!"__gshared")) { structFieldNames.insert(symbol.acSymbol.name); // TODO: remove this cast. See the note on structFieldTypes @@ -280,9 +284,17 @@ final class FirstPass : ASTVisitor if (currentSymbol.acSymbol.kind == CompletionKind.structName || currentSymbol.acSymbol.kind == CompletionKind.unionName) { - structFieldNames.insert(symbol.acSymbol.name); - // TODO: remove this cast. See the note on structFieldTypes - structFieldTypes.insert(null); + // Skip static fields (not instance members) + import std.algorithm : any; + if (!dec.storageClasses.any!(sc => + sc.token.type == tok!"static" || + sc.token.type == tok!"enum" || + sc.token.type == tok!"__gshared")) + { + structFieldNames.insert(symbol.acSymbol.name); + // TODO: remove this cast. See the note on structFieldTypes + structFieldTypes.insert(cast() dec.type); + } } } }