Skip to content

Compiler crash with generics static int, Atomics, range #22922

Open
@hugosenari

Description

@hugosenari

Description

Compiler crash with generics static int, Atomics, range

/home/hugosenari/Code/NimCloned/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: field 'intVal' is not accessible for type 'TNode' using 'kind = nkStaticExpr' [FieldDefect]

import std/atomics

type
  R [L: static int] = range[0..L]
  Q [L: static int] = object
    v: Atomic[R[L]]
  
proc f[L: static int](q: Q[L]): void =
  discard

var q: Q[4]
q.f
  

Nim Version

Nim Compiler Version 2.0.0 [Linux: amd64]
Compiled at 2023-11-07
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: a488067

Current Output

/compiler/nim.nim(164) nim
/home/hugosenari/Code/NimCloned/compiler/nim.nim(119) handleCmdLine
/home/hugosenari/Code/NimCloned/compiler/main.nim(307) mainCommand
/home/hugosenari/Code/NimCloned/compiler/main.nim(276) compileToBackend
/home/hugosenari/Code/NimCloned/compiler/main.nim(138) commandCompileToC
/home/hugosenari/Code/NimCloned/compiler/pipelines.nim(294) compilePipelineProject
/home/hugosenari/Code/NimCloned/compiler/pipelines.nim(224) compilePipelineModule
/home/hugosenari/Code/NimCloned/compiler/pipelines.nim(171) processPipelineModule
/home/hugosenari/Code/NimCloned/compiler/sem.nim(782) semWithPContext
/home/hugosenari/Code/NimCloned/compiler/sem.nim(751) semStmtAndGenerateGenerics
/home/hugosenari/Code/NimCloned/compiler/semstmts.nim(2636) semStmt
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(1160) semExprNoType
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(3229) semExpr
/home/hugosenari/Code/NimCloned/lib/system.nim(938) semStmtList
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(3083) semExpr
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(3123) semExpr
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(1141) semDirectOp
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(964) semOverloadedCallAnalyseEffects
/home/hugosenari/Code/NimCloned/compiler/semcall.nim(620) semOverloadedCall
/home/hugosenari/Code/NimCloned/compiler/semcall.nim(419) resolveOverloads
/home/hugosenari/Code/NimCloned/compiler/semcall.nim(95) pickBestCandidate
/home/hugosenari/Code/NimCloned/compiler/sigmatch.nim(2648) matches
/home/hugosenari/Code/NimCloned/compiler/sigmatch.nim(2582) matchesAux
/home/hugosenari/Code/NimCloned/compiler/sigmatch.nim(2287) paramTypesMatch
/home/hugosenari/Code/NimCloned/compiler/sigmatch.nim(2116) paramTypesMatchAux
/home/hugosenari/Code/NimCloned/compiler/sigmatch.nim(1532) typeRel
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(751) prepareMetatypeForSigmatch
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(121) replaceTypeVarsT
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(557) replaceTypeVarsTAux
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(424) handleGenericInvocation
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(121) replaceTypeVarsT
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(651) replaceTypeVarsTAux
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(265) replaceTypeVarsN
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(219) replaceTypeVarsN
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(121) replaceTypeVarsT
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(557) replaceTypeVarsTAux
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(424) handleGenericInvocation
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(121) replaceTypeVarsT
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(651) replaceTypeVarsTAux
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(265) replaceTypeVarsN
/home/hugosenari/Code/NimCloned/compiler/semtypinst.nim(240) replaceTypeVarsN
/home/hugosenari/Code/NimCloned/compiler/sem.nim(372) semConstExpr
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(119) semExprWithType
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(78) semExprCheck
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(3124) semExpr
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(2406) semMagic
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(557) semIs
/home/hugosenari/Code/NimCloned/compiler/semexprs.nim(510) isOpImpl
/home/hugosenari/Code/NimCloned/compiler/sigmatch.nim(1620) typeRel
/home/hugosenari/Code/NimCloned/compiler/sigmatch.nim(1073) typeRel
/home/hugosenari/Code/NimCloned/compiler/sigmatch.nim(1179) typeRel
/home/hugosenari/Code/NimCloned/compiler/sigmatch.nim(416) handleRange
/home/hugosenari/Code/NimCloned/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: field 'intVal' is not accessible for type 'TNode' using 'kind = nkStaticExpr' [FieldDefect]

Expected Output

Compiles or Provide a proper error (ie: can't mix static: int and range with)

Possible Solution

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions