digitalmars.D.bugs - [Issue 19047] New: Undefined identifier caused by circular import
- d-bugmail puremagic.com (50/50) Jul 02 2018 https://issues.dlang.org/show_bug.cgi?id=19047
https://issues.dlang.org/show_bug.cgi?id=19047 Issue ID: 19047 Summary: Undefined identifier caused by circular import and CTFE Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: b2.temp gmx.com 3 modules are involved: === ast.d === module ast; import symbol; string astNodesClasses() { return "alias AstNodesSeq = AstNode;"; } mixin(astNodesClasses()); alias AstNodes = AstNodesSeq; string genVisitMethods(string statements) { return "void visit(" ~ AstNodes.stringof ~ "){}"; } class AstNode{} === utils.d ==== module utils; import ast, symbol; class Foo { mixin(genVisitMethods("")); } === symbol.d === module symbol; import utils; // circular problem caused by this ================ compile with: `dmd ast.d symbol.d utils.d -lib` to get: `ast.d(12): Error: undefined identifier AstNodesSeq utils.d(8): called from here: genVisitMethods("")` Now remove the import in symbol.d and try again, no problem, error is gone. I think that there's should not be any circular issue. In bigger project CTFE fails because of this (CTFE fails because of previous error in genVisit... etc) --
Jul 02 2018