Recursive concept that has a function with the same name as an existing one causes compiler to read from `nil`
### Description

```nim
proc x(y: int): string = discard

type
  C = concept
    proc x(y: C): int
  A[T: C] = tuple
    x: T
  B*[T: C] = object
    a: A[T]
```

### Nim Version

Nim Compiler Version 2.0.8 [Linux: amd64]
Compiled at 2024-08-20
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 5935c3bfa9fec6505394867b23510eb5cbab3dbf
active boot switches:

### Current Output

```text
Hint: used config file '/home/fabricio/projects/third-party/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/fabricio/projects/third-party/Nim/config/config.nims' [Conf]
......................................................................Traceback (most recent call last)
/home/fabricio/projects/third-party/Nim/compiler/nim.nim(164) nim
/home/fabricio/projects/third-party/Nim/compiler/nim.nim(119) handleCmdLine
/home/fabricio/projects/third-party/Nim/compiler/main.nim(307) mainCommand
/home/fabricio/projects/third-party/Nim/compiler/main.nim(276) compileToBackend
/home/fabricio/projects/third-party/Nim/compiler/main.nim(138) commandCompileToC
/home/fabricio/projects/third-party/Nim/compiler/pipelines.nim(299) compilePipelineProject
/home/fabricio/projects/third-party/Nim/compiler/pipelines.nim(226) compilePipelineModule
/home/fabricio/projects/third-party/Nim/compiler/pipelines.nim(173) processPipelineModule
/home/fabricio/projects/third-party/Nim/compiler/sem.nim(867) semWithPContext
/home/fabricio/projects/third-party/Nim/compiler/sem.nim(836) semStmtAndGenerateGenerics
/home/fabricio/projects/third-party/Nim/compiler/semstmts.nim(2689) semStmt
/home/fabricio/projects/third-party/Nim/compiler/semexprs.nim(1182) semExprNoType
/home/fabricio/projects/third-party/Nim/compiler/semexprs.nim(3323) semExpr /home/fabricio/projects/nim/bug.nim(1, 1) nkStmtList
/home/fabricio/projects/third-party/Nim/lib/system.nim(937) semStmtList
/home/fabricio/projects/third-party/Nim/compiler/semexprs.nim(3328) semExpr /home/fabricio/projects/nim/bug.nim(4, 3) nkTypeSection
/home/fabricio/projects/third-party/Nim/compiler/semstmts.nim(1673) semTypeSection
/home/fabricio/projects/third-party/Nim/compiler/semstmts.nim(1442) typeSectionRightSidePass
/home/fabricio/projects/third-party/Nim/compiler/semtypes.nim(2139) semTypeNode
/home/fabricio/projects/third-party/Nim/compiler/semtypes.nim(965) semObjectNode
/home/fabricio/projects/third-party/Nim/compiler/semtypes.nim(812) semRecordNodeAux
/home/fabricio/projects/third-party/Nim/compiler/semtypes.nim(828) semRecordNodeAux
/home/fabricio/projects/third-party/Nim/compiler/semtypes.nim(2066) semTypeNode
/home/fabricio/projects/third-party/Nim/compiler/semtypes.nim(1563) semGeneric
/home/fabricio/projects/third-party/Nim/compiler/sigmatch.nim(2702) matches
/home/fabricio/projects/third-party/Nim/compiler/sigmatch.nim(2642) matchesAux
/home/fabricio/projects/third-party/Nim/compiler/sigmatch.nim(2347) paramTypesMatch
/home/fabricio/projects/third-party/Nim/compiler/sigmatch.nim(2177) paramTypesMatchAux
/home/fabricio/projects/third-party/Nim/compiler/sigmatch.nim(1787) typeRel
/home/fabricio/projects/third-party/Nim/compiler/sigmatch.nim(1743) typeRel
/home/fabricio/projects/third-party/Nim/compiler/concepts.nim(325) conceptMatch
/home/fabricio/projects/third-party/Nim/compiler/concepts.nim(290) conceptMatchNode
/home/fabricio/projects/third-party/Nim/compiler/concepts.nim(298) conceptMatchNode
/home/fabricio/projects/third-party/Nim/compiler/concepts.nim(281) matchSyms
/home/fabricio/projects/third-party/Nim/compiler/concepts.nim(256) matchSym
/home/fabricio/projects/third-party/Nim/compiler/concepts.nim(182) matchType
/home/fabricio/projects/third-party/Nim/compiler/ast.nim lastSon
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
```


### Expected Output

```text
Hint: used config file '/home/fabricio/projects/third-party/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/fabricio/projects/third-party/Nim/config/config.nims' [Conf]
......................................................................
CC: ../third-party/Nim/lib/system/exceptions.nim
CC: ../third-party/Nim/lib/std/private/since.nim
CC: ../third-party/Nim/lib/system/ctypes.nim
CC: ../third-party/Nim/lib/std/sysatomics.nim
CC: ../third-party/Nim/lib/system/ansi_c.nim
CC: ../third-party/Nim/lib/system/memory.nim
CC: ../third-party/Nim/lib/std/private/syslocks.nim
CC: ../third-party/Nim/lib/std/private/threadtypes.nim
CC: ../third-party/Nim/lib/std/private/digitsutils.nim
CC: ../third-party/Nim/lib/std/private/miscdollars.nim
CC: ../third-party/Nim/lib/std/assertions.nim
CC: ../third-party/Nim/lib/system/iterators.nim
CC: ../third-party/Nim/lib/system/coro_detection.nim
CC: ../third-party/Nim/lib/std/private/dragonbox.nim
CC: ../third-party/Nim/lib/std/private/schubfach.nim
CC: ../third-party/Nim/lib/std/formatfloat.nim
CC: ../third-party/Nim/lib/std/objectdollar.nim
CC: ../third-party/Nim/lib/system/dollars.nim
CC: ../third-party/Nim/lib/std/typedthreads.nim
CC: ../third-party/Nim/lib/system/stacktraces.nim
CC: ../third-party/Nim/lib/std/private/bitops_utils.nim
CC: ../third-party/Nim/lib/system/countbits_impl.nim
CC: ../third-party/Nim/lib/system/repr_v2.nim
CC: ../third-party/Nim/lib/std/widestrs.nim
CC: ../third-party/Nim/lib/std/syncio.nim
CC: ../third-party/Nim/lib/system.nim
CC: bug.nim
Hint:  [Link]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
27785 lines; 1.420s; 30.406MiB peakmem; proj: /home/fabricio/projects/nim/bug.nim; out: /home/fabricio/.cache/nim/bug_d/bug_39498606B2F6B94C1188035595434CAE17A4CF94 [SuccessX]
Hint: /home/fabricio/.cache/nim/bug_d/bug_39498606B2F6B94C1188035595434CAE17A4CF94 [Exec]
```


### Known Workarounds

_No response_

### Additional Information

_No response_