-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
bugSomething isn't workingSomething isn't workingcompiler/semRelated to semantic-analysis system of the compilerRelated to semantic-analysis system of the compiler
Description
Specification
In a template, substitution takes priority when you have an object with a field name, and a parameter with a name, which makes sense, but the issue here is that it isn't reported correctly.
Example
type
LogLevel* = enum
llTrace
LogData = object
lvl: LogLevel
template log*(
lvl: LogLevel,
) = LogData(lvl: lvl)
log(LogLevel.llTrace)
Actual Output
nim.nim nim
nim.nim handleCmdLine
main.nim mainCommand
main.nim compileToBackend
main.nim commandCompileToC
modules.nim compileProject
modules.nim compileModule
passes.nim processModule
passes.nim processTopLevelStmt
sem.nim myProcess
sem.nim semStmtAndGenerateGenerics nkStmtList 383994 /var/home/chronos/test/main.nim(12, 3)
semstmts.nim semStmt
semexprs.nim semExprNoType
semexprs.nim semExpr nkStmtList 383994 /var/home/chronos/test/main.nim(12, 3)
semstmts.nim semStmtList nkStmtList 383994 /var/home/chronos/test/main.nim(12, 3)
semexprs.nim semExpr nkCall 383989 /var/home/chronos/test/main.nim(12, 3)
semexprs.nim semDirectOp
semexprs.nim afterCallActions
semexprs.nim semTemplateExpr
sem.nim semAfterMacroCall nkStmtList 384003 /var/home/chronos/test/main.nim(12, 3)
semstmts.nim semStmt
semexprs.nim semExprNoType
semexprs.nim semExpr nkStmtList 384003 /var/home/chronos/test/main.nim(12, 3)
semstmts.nim semStmtList nkStmtList 384003 /var/home/chronos/test/main.nim(12, 3)
semexprs.nim semExpr nkObjConstr 384004 /var/home/chronos/test/main.nim(12, 3)
semobjconstr.nim semObjConstr
errorhandling.nim newError nkSym 384007 /var/home/chronos/test/main.nim(12, 12)
msgs.nim emit
msgs.nim defaultDiagHandler
msgs.nim handleReport
options.nim report
cli_reporter.nim reportHook
cli_reporter.nim reportFull
cli_reporter.nim reportFull
cli_reporter.nim reportBody
fatal.nim sysFatal
Error: unhandled exception: field 'ident' is not accessible for type 'TNode' using 'kind = nkSym' [FieldDefect]
Expected Output
Two options:
Error: undeclared field: 'llTrace' for type main.LogData
Possible Solution
Additional Information
References
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompiler/semRelated to semantic-analysis system of the compilerRelated to semantic-analysis system of the compiler