Skip to content

Conversation

@metagn
Copy link
Collaborator

@metagn metagn commented Dec 5, 2024

fixes #24503, refs #22655, alternative to #24509 and #24510

Instead of producing a different node as in #24510, we keep the produced node the same, but give it the actual type rather than the tyGenericBody type of the symbol. This is possibly less intrusive but still not correct as the symbol has a different type than the symbol node.

@metagn metagn marked this pull request as draft December 6, 2024 14:09
@metagn
Copy link
Collaborator Author

metagn commented Feb 7, 2025

Only union fails with this:

  nim c -r tests/treadme.nim
  Hint: used config file '/home/runner/work/Nim/Nim/config/nim.cfg' [Conf]
  Hint: used config file '/home/runner/work/Nim/Nim/config/config.nims' [Conf]
  Hint: used config file '/home/runner/work/Nim/Nim/pkgstemp/union/tests/config.nims' [Conf]
  ..........................................................................................
  /home/runner/work/Nim/Nim/pkgstemp/union/union/ortraits.nim(40, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union/ortraits.nim(46, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union/ortraits.nim(75, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union/ortraits.nim(92, 8) Warning: use explicit initialization of 'result' for clarity [Uninit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union/ortraits.nim(90, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  .
  /home/runner/work/Nim/Nim/pkgstemp/union/union/uniontraits.nim(157, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union/uniontraits.nim(167, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union/uniontraits.nim(189, 7) Warning: use explicit initialization of 'result' for clarity [Uninit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union/uniontraits.nim(186, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(255, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(261, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(285, 8) Warning: use explicit initialization of 'typExpr' for clarity [Uninit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(291, 12) Warning: use explicit initialization of 'typExpr' for clarity [Uninit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(321, 7) Warning: use explicit initialization of 'result' for clarity [Uninit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(318, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(353, 7) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(548, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(561, 5) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(573, 7) Hint: 'unionType' is declared but not used [XDeclaredButNotUsed]
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(86, 57) Warning: imported and not used: 'genasts' [UnusedImport]
  stack trace: (most recent call last)
  /home/runner/work/Nim/Nim/pkgstemp/union/union.nim(141, 22) as
  /home/runner/work/Nim/Nim/pkgstemp/union/union/uniontraits.nim(142, 18) getVariant
  /home/runner/work/Nim/Nim/pkgstemp/union/union/uniontraits.nim(110, 4) recCase
  /home/runner/work/Nim/Nim/pkgstemp/union/tests/treadme.nim(15, 1) template/generic instantiation of `doAssert` from here
  /home/runner/work/Nim/Nim/pkgstemp/union/tests/treadme.nim(8, 19) template/generic instantiation of `as` from here
  /home/runner/work/Nim/Nim/pkgstemp/union/union/uniontraits.nim(110, 4) Error: cannot get child of node kind: nnkNilLit

But makes a lot less sense than #24510 imo

@metagn metagn closed this Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Building some applications causes whole system to crash (out of memory)

1 participant