Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identifier expected or compiler segfault with templates over generic type in type section #23854

Closed
mratsim opened this issue Jul 17, 2024 · 6 comments · Fixed by #23983
Closed

Comments

@mratsim
Copy link
Collaborator

mratsim commented Jul 17, 2024

A slight modification to #23853, depending if we use method call syntax or function call syntax we get either identifier expected or a compiler segfault on uninitialized value

import std/bitops

const WordBitWidth = sizeof(pointer) * 8

func wordsRequired*(bits: int): int {.inline.} =
  const divShiftor = fastLog2(uint32(WordBitWidth))
  result = (bits + WordBitWidth - 1) shr divShiftor

type
  Algebra* = enum
    BLS12_381

  BigInt*[bits: static int] = object
    limbs*: array[wordsRequired(bits), uint]

  Fr*[Name: static Algebra] = object
    residue_form*: BigInt[255]

  Fp*[Name: static Algebra] = object
    residue_form*: BigInt[381]

  FF*[Name: static Algebra] = Fp[Name] or Fr[Name]

type
  EC_ShortW_Aff*[F] = object
    ## Elliptic curve point for a curve in Short Weierstrass form
    ##   y² = x³ + a x + b
    ##
    ## over a field F
    x*, y*: F

type FieldKind* = enum
  kBaseField
  kScalarField

template getBigInt*[Name: static Algebra](T: type FF[Name]): untyped =
  ## Get the underlying BigInt type.
  typeof(default(T).mres)

func bits*[Name: static Algebra](T: type FF[Name]): static int =
  T.getBigInt().bits

template getScalarField*(EC: type EC_ShortW_Aff): untyped =
  Fr[EC.F.Name]

# ------------------------------------------------------------------------------

type
  ECFFT_Descriptor*[EC] = object
    ## Metadata for FFT on Elliptic Curve
    order*: int
    # rootsOfUnity*: ptr UncheckedArray[BigInt[EC.getScalarField().bits()]]  # Error: in expression 'EC.getScalarField()': identifier expected, but found 'EC.getScalarField'
    rootsOfUnity*: ptr UncheckedArray[BigInt[getScalarField(EC).bits()]] # Compiler SIGSEGV: Illegal Storage Access

func new*(T: type ECFFT_Descriptor): T =
  discard

# ------------------------------------------------------------------------------

proc main() =
  let ctx = ECFFT_Descriptor[EC_ShortW_Aff[Fp[BLS12_381]]].new()

main()
@mratsim
Copy link
Collaborator Author

mratsim commented Jul 17, 2024

Notice that if not in an UncheckedArray or a seq, the following compiles

import std/bitops

const WordBitWidth = sizeof(pointer) * 8

func wordsRequired*(bits: int): int {.inline.} =
  const divShiftor = fastLog2(uint32(WordBitWidth))
  result = (bits + WordBitWidth - 1) shr divShiftor

type
  Algebra* = enum
    BLS12_381

  BigInt*[bits: static int] = object
    limbs*: array[wordsRequired(bits), uint]

  Fr*[Name: static Algebra] = object
    residue_form*: BigInt[255]

  Fp*[Name: static Algebra] = object
    residue_form*: BigInt[381]

  FF*[Name: static Algebra] = Fp[Name] or Fr[Name]

type
  EC_ShortW_Aff*[F] = object
    ## Elliptic curve point for a curve in Short Weierstrass form
    ##   y² = x³ + a x + b
    ##
    ## over a field F
    x*, y*: F

template getScalarField*(EC: type EC_ShortW_Aff): untyped =
  Fr[EC.F.Name]

# ------------------------------------------------------------------------------

type IpaProof*[logN: static int, EC] = object
  L*{.align: 64.}: array[logN, EC]
  R*{.align: 64.}: array[logN, EC]
  a0*: getScalarField(EC)          # compiles
  # a0*: EC.getScalarField()        #  Error: in expression 'EC.getScalarField()': identifier expected, but found 'EC.getScalarField'

func new*(T: type IpaProof): T =
  discard

# ------------------------------------------------------------------------------

proc main() =
  let proof = IpaProof[8, EC_ShortW_Aff[Fp[BLS12_381]]].new()

main()

@juancarlospaco
Copy link
Collaborator

!nim c

import std/bitops

const WordBitWidth = sizeof(pointer) * 8

func wordsRequired*(bits: int): int {.inline.} =
  const divShiftor = fastLog2(uint32(WordBitWidth))
  result = (bits + WordBitWidth - 1) shr divShiftor

type
  Algebra* = enum
    BLS12_381

  BigInt*[bits: static int] = object
    limbs*: array[wordsRequired(bits), uint]

  Fr*[Name: static Algebra] = object
    residue_form*: BigInt[255]

  Fp*[Name: static Algebra] = object
    residue_form*: BigInt[381]

  FF*[Name: static Algebra] = Fp[Name] or Fr[Name]

type
  EC_ShortW_Aff*[F] = object
    ## Elliptic curve point for a curve in Short Weierstrass form
    ##   y² = x³ + a x + b
    ##
    ## over a field F
    x*, y*: F

type FieldKind* = enum
  kBaseField
  kScalarField

template getBigInt*[Name: static Algebra](T: type FF[Name]): untyped =
  ## Get the underlying BigInt type.
  typeof(default(T).mres)

func bits*[Name: static Algebra](T: type FF[Name]): static int =
  T.getBigInt().bits

template getScalarField*(EC: type EC_ShortW_Aff): untyped =
  Fr[EC.F.Name]

# ------------------------------------------------------------------------------

type
  ECFFT_Descriptor*[EC] = object
    ## Metadata for FFT on Elliptic Curve
    order*: int
    # rootsOfUnity*: ptr UncheckedArray[BigInt[EC.getScalarField().bits()]]  # Error: in expression 'EC.getScalarField()': identifier expected, but found 'EC.getScalarField'
    rootsOfUnity*: ptr UncheckedArray[BigInt[getScalarField(EC).bits()]] # Compiler SIGSEGV: Illegal Storage Access

func new*(T: type ECFFT_Descriptor): T =
  discard

# ------------------------------------------------------------------------------

proc main() =
  let ctx = ECFFT_Descriptor[EC_ShortW_Aff[Fp[BLS12_381]]].new()

main()

Copy link
Contributor

🐧 Linux bisect by @juancarlospaco (collaborator)
devel 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-07-18T13:01:38
  • Finished 2024-07-18T13:01:38
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("bitops")
    )
  ),
  nnkConstSection.newTree(
    nnkConstDef.newTree(
      newIdentNode("WordBitWidth"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("*"),
        nnkCall.newTree(
          newIdentNode("sizeof"),
          newIdentNode("pointer")
        ),
        newLit(8)
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("wordsRequired")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("bits"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("inline")
    ),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkConstSection.newTree(
        nnkConstDef.newTree(
          newIdentNode("divShiftor"),
          newEmptyNode(),
          nnkCall.newTree(
            newIdentNode("fastLog2"),
            nnkCall.newTree(
              newIdentNode("uint32"),
              newIdentNode("WordBitWidth")
            )
          )
        )
      ),
      nnkAsgn.newTree(
        newIdentNode("result"),
        nnkInfix.newTree(
          newIdentNode("shr"),
          nnkPar.newTree(
            nnkInfix.newTree(
              newIdentNode("-"),
              nnkInfix.newTree(
                newIdentNode("+"),
                newIdentNode("bits"),
                newIdentNode("WordBitWidth")
              ),
              newLit(1)
            )
          ),
          newIdentNode("divShiftor")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Algebra")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("BLS12_381")
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("BigInt")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("bits"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("limbs")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("array"),
              nnkCall.newTree(
                newIdentNode("wordsRequired"),
                newIdentNode("bits")
              ),
              newIdentNode("uint")
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fr")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(255)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fp")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(381)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FF")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("or"),
        nnkBracketExpr.newTree(
          newIdentNode("Fp"),
          newIdentNode("Name")
        ),
        nnkBracketExpr.newTree(
          newIdentNode("Fr"),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("EC_ShortW_Aff")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("F"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("x")
            ),
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("y")
            ),
            newIdentNode("F"),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FieldKind")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("kBaseField"),
        newIdentNode("kScalarField")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getBigInt")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newCommentStmtNode("Get the underlying BigInt type."),
      nnkCall.newTree(
        newIdentNode("typeof"),
        nnkDotExpr.newTree(
          nnkCall.newTree(
            newIdentNode("default"),
            newIdentNode("T")
          ),
          newIdentNode("mres")
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("bits")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkCommand.newTree(
        newIdentNode("static"),
        newIdentNode("int")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDotExpr.newTree(
        nnkCall.newTree(
          nnkDotExpr.newTree(
            newIdentNode("T"),
            newIdentNode("getBigInt")
          )
        ),
        newIdentNode("bits")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getScalarField")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("EC"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("EC_ShortW_Aff")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Fr"),
        nnkDotExpr.newTree(
          nnkDotExpr.newTree(
            newIdentNode("EC"),
            newIdentNode("F")
          ),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("ECFFT_Descriptor")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("EC"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("order")
            ),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("rootsOfUnity")
            ),
            nnkPtrTy.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("UncheckedArray"),
                nnkBracketExpr.newTree(
                  newIdentNode("BigInt"),
                  nnkCall.newTree(
                    nnkDotExpr.newTree(
                      nnkCall.newTree(
                        newIdentNode("getScalarField"),
                        newIdentNode("EC")
                      ),
                      newIdentNode("bits")
                    )
                  )
                )
              )
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("new")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("ECFFT_Descriptor")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("main"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ctx"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkDotExpr.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("ECFFT_Descriptor"),
                nnkBracketExpr.newTree(
                  newIdentNode("EC_ShortW_Aff"),
                  nnkBracketExpr.newTree(
                    newIdentNode("Fp"),
                    newIdentNode("BLS12_381")
                  )
                )
              ),
              newIdentNode("new")
            )
          )
        )
      )
    )
  ),
  nnkCall.newTree(
    newIdentNode("main")
  )
)
stable 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-07-18T13:01:42
  • Finished 2024-07-18T13:01:42
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("bitops")
    )
  ),
  nnkConstSection.newTree(
    nnkConstDef.newTree(
      newIdentNode("WordBitWidth"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("*"),
        nnkCall.newTree(
          newIdentNode("sizeof"),
          newIdentNode("pointer")
        ),
        newLit(8)
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("wordsRequired")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("bits"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("inline")
    ),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkConstSection.newTree(
        nnkConstDef.newTree(
          newIdentNode("divShiftor"),
          newEmptyNode(),
          nnkCall.newTree(
            newIdentNode("fastLog2"),
            nnkCall.newTree(
              newIdentNode("uint32"),
              newIdentNode("WordBitWidth")
            )
          )
        )
      ),
      nnkAsgn.newTree(
        newIdentNode("result"),
        nnkInfix.newTree(
          newIdentNode("shr"),
          nnkPar.newTree(
            nnkInfix.newTree(
              newIdentNode("-"),
              nnkInfix.newTree(
                newIdentNode("+"),
                newIdentNode("bits"),
                newIdentNode("WordBitWidth")
              ),
              newLit(1)
            )
          ),
          newIdentNode("divShiftor")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Algebra")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("BLS12_381")
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("BigInt")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("bits"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("limbs")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("array"),
              nnkCall.newTree(
                newIdentNode("wordsRequired"),
                newIdentNode("bits")
              ),
              newIdentNode("uint")
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fr")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(255)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fp")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(381)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FF")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("or"),
        nnkBracketExpr.newTree(
          newIdentNode("Fp"),
          newIdentNode("Name")
        ),
        nnkBracketExpr.newTree(
          newIdentNode("Fr"),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("EC_ShortW_Aff")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("F"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("x")
            ),
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("y")
            ),
            newIdentNode("F"),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FieldKind")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("kBaseField"),
        newIdentNode("kScalarField")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getBigInt")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newCommentStmtNode("Get the underlying BigInt type."),
      nnkCall.newTree(
        newIdentNode("typeof"),
        nnkDotExpr.newTree(
          nnkCall.newTree(
            newIdentNode("default"),
            newIdentNode("T")
          ),
          newIdentNode("mres")
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("bits")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkCommand.newTree(
        newIdentNode("static"),
        newIdentNode("int")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDotExpr.newTree(
        nnkCall.newTree(
          nnkDotExpr.newTree(
            newIdentNode("T"),
            newIdentNode("getBigInt")
          )
        ),
        newIdentNode("bits")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getScalarField")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("EC"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("EC_ShortW_Aff")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Fr"),
        nnkDotExpr.newTree(
          nnkDotExpr.newTree(
            newIdentNode("EC"),
            newIdentNode("F")
          ),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("ECFFT_Descriptor")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("EC"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("order")
            ),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("rootsOfUnity")
            ),
            nnkPtrTy.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("UncheckedArray"),
                nnkBracketExpr.newTree(
                  newIdentNode("BigInt"),
                  nnkCall.newTree(
                    nnkDotExpr.newTree(
                      nnkCall.newTree(
                        newIdentNode("getScalarField"),
                        newIdentNode("EC")
                      ),
                      newIdentNode("bits")
                    )
                  )
                )
              )
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("new")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("ECFFT_Descriptor")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("main"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ctx"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkDotExpr.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("ECFFT_Descriptor"),
                nnkBracketExpr.newTree(
                  newIdentNode("EC_ShortW_Aff"),
                  nnkBracketExpr.newTree(
                    newIdentNode("Fp"),
                    newIdentNode("BLS12_381")
                  )
                )
              ),
              newIdentNode("new")
            )
          )
        )
      )
    )
  ),
  nnkCall.newTree(
    newIdentNode("main")
  )
)
2.0.4 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-07-18T13:01:45
  • Finished 2024-07-18T13:01:45
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("bitops")
    )
  ),
  nnkConstSection.newTree(
    nnkConstDef.newTree(
      newIdentNode("WordBitWidth"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("*"),
        nnkCall.newTree(
          newIdentNode("sizeof"),
          newIdentNode("pointer")
        ),
        newLit(8)
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("wordsRequired")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("bits"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("inline")
    ),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkConstSection.newTree(
        nnkConstDef.newTree(
          newIdentNode("divShiftor"),
          newEmptyNode(),
          nnkCall.newTree(
            newIdentNode("fastLog2"),
            nnkCall.newTree(
              newIdentNode("uint32"),
              newIdentNode("WordBitWidth")
            )
          )
        )
      ),
      nnkAsgn.newTree(
        newIdentNode("result"),
        nnkInfix.newTree(
          newIdentNode("shr"),
          nnkPar.newTree(
            nnkInfix.newTree(
              newIdentNode("-"),
              nnkInfix.newTree(
                newIdentNode("+"),
                newIdentNode("bits"),
                newIdentNode("WordBitWidth")
              ),
              newLit(1)
            )
          ),
          newIdentNode("divShiftor")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Algebra")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("BLS12_381")
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("BigInt")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("bits"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("limbs")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("array"),
              nnkCall.newTree(
                newIdentNode("wordsRequired"),
                newIdentNode("bits")
              ),
              newIdentNode("uint")
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fr")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(255)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fp")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(381)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FF")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("or"),
        nnkBracketExpr.newTree(
          newIdentNode("Fp"),
          newIdentNode("Name")
        ),
        nnkBracketExpr.newTree(
          newIdentNode("Fr"),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("EC_ShortW_Aff")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("F"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("x")
            ),
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("y")
            ),
            newIdentNode("F"),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FieldKind")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("kBaseField"),
        newIdentNode("kScalarField")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getBigInt")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newCommentStmtNode("Get the underlying BigInt type."),
      nnkCall.newTree(
        newIdentNode("typeof"),
        nnkDotExpr.newTree(
          nnkCall.newTree(
            newIdentNode("default"),
            newIdentNode("T")
          ),
          newIdentNode("mres")
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("bits")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkCommand.newTree(
        newIdentNode("static"),
        newIdentNode("int")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDotExpr.newTree(
        nnkCall.newTree(
          nnkDotExpr.newTree(
            newIdentNode("T"),
            newIdentNode("getBigInt")
          )
        ),
        newIdentNode("bits")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getScalarField")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("EC"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("EC_ShortW_Aff")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Fr"),
        nnkDotExpr.newTree(
          nnkDotExpr.newTree(
            newIdentNode("EC"),
            newIdentNode("F")
          ),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("ECFFT_Descriptor")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("EC"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("order")
            ),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("rootsOfUnity")
            ),
            nnkPtrTy.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("UncheckedArray"),
                nnkBracketExpr.newTree(
                  newIdentNode("BigInt"),
                  nnkCall.newTree(
                    nnkDotExpr.newTree(
                      nnkCall.newTree(
                        newIdentNode("getScalarField"),
                        newIdentNode("EC")
                      ),
                      newIdentNode("bits")
                    )
                  )
                )
              )
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("new")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("ECFFT_Descriptor")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("main"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ctx"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkDotExpr.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("ECFFT_Descriptor"),
                nnkBracketExpr.newTree(
                  newIdentNode("EC_ShortW_Aff"),
                  nnkBracketExpr.newTree(
                    newIdentNode("Fp"),
                    newIdentNode("BLS12_381")
                  )
                )
              ),
              newIdentNode("new")
            )
          )
        )
      )
    )
  ),
  nnkCall.newTree(
    newIdentNode("main")
  )
)
2.0.0 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-07-18T13:01:48
  • Finished 2024-07-18T13:01:49
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("bitops")
    )
  ),
  nnkConstSection.newTree(
    nnkConstDef.newTree(
      newIdentNode("WordBitWidth"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("*"),
        nnkCall.newTree(
          newIdentNode("sizeof"),
          newIdentNode("pointer")
        ),
        newLit(8)
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("wordsRequired")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("bits"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("inline")
    ),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkConstSection.newTree(
        nnkConstDef.newTree(
          newIdentNode("divShiftor"),
          newEmptyNode(),
          nnkCall.newTree(
            newIdentNode("fastLog2"),
            nnkCall.newTree(
              newIdentNode("uint32"),
              newIdentNode("WordBitWidth")
            )
          )
        )
      ),
      nnkAsgn.newTree(
        newIdentNode("result"),
        nnkInfix.newTree(
          newIdentNode("shr"),
          nnkPar.newTree(
            nnkInfix.newTree(
              newIdentNode("-"),
              nnkInfix.newTree(
                newIdentNode("+"),
                newIdentNode("bits"),
                newIdentNode("WordBitWidth")
              ),
              newLit(1)
            )
          ),
          newIdentNode("divShiftor")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Algebra")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("BLS12_381")
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("BigInt")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("bits"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("limbs")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("array"),
              nnkCall.newTree(
                newIdentNode("wordsRequired"),
                newIdentNode("bits")
              ),
              newIdentNode("uint")
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fr")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(255)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fp")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(381)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FF")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("or"),
        nnkBracketExpr.newTree(
          newIdentNode("Fp"),
          newIdentNode("Name")
        ),
        nnkBracketExpr.newTree(
          newIdentNode("Fr"),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("EC_ShortW_Aff")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("F"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("x")
            ),
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("y")
            ),
            newIdentNode("F"),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FieldKind")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("kBaseField"),
        newIdentNode("kScalarField")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getBigInt")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newCommentStmtNode("Get the underlying BigInt type."),
      nnkCall.newTree(
        newIdentNode("typeof"),
        nnkDotExpr.newTree(
          nnkCall.newTree(
            newIdentNode("default"),
            newIdentNode("T")
          ),
          newIdentNode("mres")
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("bits")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkCommand.newTree(
        newIdentNode("static"),
        newIdentNode("int")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDotExpr.newTree(
        nnkCall.newTree(
          nnkDotExpr.newTree(
            newIdentNode("T"),
            newIdentNode("getBigInt")
          )
        ),
        newIdentNode("bits")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getScalarField")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("EC"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("EC_ShortW_Aff")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Fr"),
        nnkDotExpr.newTree(
          nnkDotExpr.newTree(
            newIdentNode("EC"),
            newIdentNode("F")
          ),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("ECFFT_Descriptor")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("EC"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("order")
            ),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("rootsOfUnity")
            ),
            nnkPtrTy.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("UncheckedArray"),
                nnkBracketExpr.newTree(
                  newIdentNode("BigInt"),
                  nnkCall.newTree(
                    nnkDotExpr.newTree(
                      nnkCall.newTree(
                        newIdentNode("getScalarField"),
                        newIdentNode("EC")
                      ),
                      newIdentNode("bits")
                    )
                  )
                )
              )
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("new")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("ECFFT_Descriptor")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("main"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ctx"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkDotExpr.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("ECFFT_Descriptor"),
                nnkBracketExpr.newTree(
                  newIdentNode("EC_ShortW_Aff"),
                  nnkBracketExpr.newTree(
                    newIdentNode("Fp"),
                    newIdentNode("BLS12_381")
                  )
                )
              ),
              newIdentNode("new")
            )
          )
        )
      )
    )
  ),
  nnkCall.newTree(
    newIdentNode("main")
  )
)
1.6.20 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(39, 60) Error: type mismatch: got <typedesc[EC]>
but expected one of:
template getScalarField(EC: type EC_ShortW_Aff): untyped
  first type mismatch at position: 1
  required type for EC: typedesc[EC_ShortW_Aff]
  but expression 'EC' is of type: typedesc[EC]

expression: getScalarField(EC)
fatal.nim(54)            sysFatal
Error: unhandled exception: options.nim(662, 14) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-07-18T13:01:52
  • Finished 2024-07-18T13:01:52
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("bitops")
    )
  ),
  nnkConstSection.newTree(
    nnkConstDef.newTree(
      newIdentNode("WordBitWidth"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("*"),
        nnkCall.newTree(
          newIdentNode("sizeof"),
          newIdentNode("pointer")
        ),
        newLit(8)
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("wordsRequired")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("bits"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("inline")
    ),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkConstSection.newTree(
        nnkConstDef.newTree(
          newIdentNode("divShiftor"),
          newEmptyNode(),
          nnkCall.newTree(
            newIdentNode("fastLog2"),
            nnkCall.newTree(
              newIdentNode("uint32"),
              newIdentNode("WordBitWidth")
            )
          )
        )
      ),
      nnkAsgn.newTree(
        newIdentNode("result"),
        nnkInfix.newTree(
          newIdentNode("shr"),
          nnkPar.newTree(
            nnkInfix.newTree(
              newIdentNode("-"),
              nnkInfix.newTree(
                newIdentNode("+"),
                newIdentNode("bits"),
                newIdentNode("WordBitWidth")
              ),
              newLit(1)
            )
          ),
          newIdentNode("divShiftor")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Algebra")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("BLS12_381")
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("BigInt")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("bits"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("limbs")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("array"),
              nnkCall.newTree(
                newIdentNode("wordsRequired"),
                newIdentNode("bits")
              ),
              newIdentNode("uint")
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fr")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(255)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fp")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(381)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FF")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("or"),
        nnkBracketExpr.newTree(
          newIdentNode("Fp"),
          newIdentNode("Name")
        ),
        nnkBracketExpr.newTree(
          newIdentNode("Fr"),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("EC_ShortW_Aff")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("F"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("x")
            ),
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("y")
            ),
            newIdentNode("F"),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FieldKind")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("kBaseField"),
        newIdentNode("kScalarField")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getBigInt")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newCommentStmtNode("Get the underlying BigInt type."),
      nnkCall.newTree(
        newIdentNode("typeof"),
        nnkDotExpr.newTree(
          nnkCall.newTree(
            newIdentNode("default"),
            newIdentNode("T")
          ),
          newIdentNode("mres")
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("bits")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkCommand.newTree(
        newIdentNode("static"),
        newIdentNode("int")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDotExpr.newTree(
        nnkCall.newTree(
          nnkDotExpr.newTree(
            newIdentNode("T"),
            newIdentNode("getBigInt")
          )
        ),
        newIdentNode("bits")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getScalarField")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("EC"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("EC_ShortW_Aff")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Fr"),
        nnkDotExpr.newTree(
          nnkDotExpr.newTree(
            newIdentNode("EC"),
            newIdentNode("F")
          ),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("ECFFT_Descriptor")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("EC"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("order")
            ),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("rootsOfUnity")
            ),
            nnkPtrTy.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("UncheckedArray"),
                nnkBracketExpr.newTree(
                  newIdentNode("BigInt"),
                  nnkCall.newTree(
                    nnkDotExpr.newTree(
                      nnkCall.newTree(
                        newIdentNode("getScalarField"),
                        newIdentNode("EC")
                      ),
                      newIdentNode("bits")
                    )
                  )
                )
              )
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("new")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("ECFFT_Descriptor")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("main"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ctx"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkDotExpr.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("ECFFT_Descriptor"),
                nnkBracketExpr.newTree(
                  newIdentNode("EC_ShortW_Aff"),
                  nnkBracketExpr.newTree(
                    newIdentNode("Fp"),
                    newIdentNode("BLS12_381")
                  )
                )
              ),
              newIdentNode("new")
            )
          )
        )
      )
    )
  ),
  nnkCall.newTree(
    newIdentNode("main")
  )
)
1.4.8 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(39, 60) Error: type mismatch: got <type EC>
but expected one of: 
template getScalarField(EC: type EC_ShortW_Aff): untyped
  first type mismatch at position: 1
  required type for EC: type EC_ShortW_Aff
  but expression 'EC' is of type: type EC

expression: getScalarField(EC)

IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-07-18T13:01:55
  • Finished 2024-07-18T13:01:55
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("bitops")
    )
  ),
  nnkConstSection.newTree(
    nnkConstDef.newTree(
      newIdentNode("WordBitWidth"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("*"),
        nnkCall.newTree(
          newIdentNode("sizeof"),
          newIdentNode("pointer")
        ),
        newLit(8)
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("wordsRequired")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("bits"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("inline")
    ),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkConstSection.newTree(
        nnkConstDef.newTree(
          newIdentNode("divShiftor"),
          newEmptyNode(),
          nnkCall.newTree(
            newIdentNode("fastLog2"),
            nnkCall.newTree(
              newIdentNode("uint32"),
              newIdentNode("WordBitWidth")
            )
          )
        )
      ),
      nnkAsgn.newTree(
        newIdentNode("result"),
        nnkInfix.newTree(
          newIdentNode("shr"),
          nnkPar.newTree(
            nnkInfix.newTree(
              newIdentNode("-"),
              nnkInfix.newTree(
                newIdentNode("+"),
                newIdentNode("bits"),
                newIdentNode("WordBitWidth")
              ),
              newLit(1)
            )
          ),
          newIdentNode("divShiftor")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Algebra")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("BLS12_381")
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("BigInt")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("bits"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("limbs")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("array"),
              nnkCall.newTree(
                newIdentNode("wordsRequired"),
                newIdentNode("bits")
              ),
              newIdentNode("uint")
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fr")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(255)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fp")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(381)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FF")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("or"),
        nnkBracketExpr.newTree(
          newIdentNode("Fp"),
          newIdentNode("Name")
        ),
        nnkBracketExpr.newTree(
          newIdentNode("Fr"),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("EC_ShortW_Aff")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("F"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("x")
            ),
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("y")
            ),
            newIdentNode("F"),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FieldKind")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("kBaseField"),
        newIdentNode("kScalarField")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getBigInt")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newCommentStmtNode("Get the underlying BigInt type."),
      nnkCall.newTree(
        newIdentNode("typeof"),
        nnkDotExpr.newTree(
          nnkCall.newTree(
            newIdentNode("default"),
            newIdentNode("T")
          ),
          newIdentNode("mres")
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("bits")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkCommand.newTree(
        newIdentNode("static"),
        newIdentNode("int")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDotExpr.newTree(
        nnkCall.newTree(
          nnkDotExpr.newTree(
            newIdentNode("T"),
            newIdentNode("getBigInt")
          )
        ),
        newIdentNode("bits")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getScalarField")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("EC"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("EC_ShortW_Aff")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Fr"),
        nnkDotExpr.newTree(
          nnkDotExpr.newTree(
            newIdentNode("EC"),
            newIdentNode("F")
          ),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("ECFFT_Descriptor")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("EC"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("order")
            ),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("rootsOfUnity")
            ),
            nnkPtrTy.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("UncheckedArray"),
                nnkBracketExpr.newTree(
                  newIdentNode("BigInt"),
                  nnkCall.newTree(
                    nnkDotExpr.newTree(
                      nnkCall.newTree(
                        newIdentNode("getScalarField"),
                        newIdentNode("EC")
                      ),
                      newIdentNode("bits")
                    )
                  )
                )
              )
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("new")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("ECFFT_Descriptor")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("main"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ctx"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkDotExpr.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("ECFFT_Descriptor"),
                nnkBracketExpr.newTree(
                  newIdentNode("EC_ShortW_Aff"),
                  nnkBracketExpr.newTree(
                    newIdentNode("Fp"),
                    newIdentNode("BLS12_381")
                  )
                )
              ),
              newIdentNode("new")
            )
          )
        )
      )
    )
  ),
  nnkCall.newTree(
    newIdentNode("main")
  )
)
1.2.18 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(39, 60) Error: type mismatch: got <type EC>
but expected one of: 
template getScalarField(EC: type EC_ShortW_Aff): untyped
  first type mismatch at position: 1
  required type for EC: type EC_ShortW_Aff
  but expression 'EC' is of type: type EC

expression: getScalarField(EC)

IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-07-18T13:01:57
  • Finished 2024-07-18T13:01:57
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("bitops")
    )
  ),
  nnkConstSection.newTree(
    nnkConstDef.newTree(
      newIdentNode("WordBitWidth"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("*"),
        nnkCall.newTree(
          newIdentNode("sizeof"),
          newIdentNode("pointer")
        ),
        newLit(8)
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("wordsRequired")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("bits"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("inline")
    ),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkConstSection.newTree(
        nnkConstDef.newTree(
          newIdentNode("divShiftor"),
          newEmptyNode(),
          nnkCall.newTree(
            newIdentNode("fastLog2"),
            nnkCall.newTree(
              newIdentNode("uint32"),
              newIdentNode("WordBitWidth")
            )
          )
        )
      ),
      nnkAsgn.newTree(
        newIdentNode("result"),
        nnkInfix.newTree(
          newIdentNode("shr"),
          nnkPar.newTree(
            nnkInfix.newTree(
              newIdentNode("-"),
              nnkInfix.newTree(
                newIdentNode("+"),
                newIdentNode("bits"),
                newIdentNode("WordBitWidth")
              ),
              newLit(1)
            )
          ),
          newIdentNode("divShiftor")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Algebra")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("BLS12_381")
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("BigInt")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("bits"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("limbs")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("array"),
              nnkCall.newTree(
                newIdentNode("wordsRequired"),
                newIdentNode("bits")
              ),
              newIdentNode("uint")
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fr")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(255)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fp")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(381)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FF")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("or"),
        nnkBracketExpr.newTree(
          newIdentNode("Fp"),
          newIdentNode("Name")
        ),
        nnkBracketExpr.newTree(
          newIdentNode("Fr"),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("EC_ShortW_Aff")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("F"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("x")
            ),
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("y")
            ),
            newIdentNode("F"),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FieldKind")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("kBaseField"),
        newIdentNode("kScalarField")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getBigInt")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newCommentStmtNode("Get the underlying BigInt type."),
      nnkCall.newTree(
        newIdentNode("typeof"),
        nnkDotExpr.newTree(
          nnkCall.newTree(
            newIdentNode("default"),
            newIdentNode("T")
          ),
          newIdentNode("mres")
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("bits")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkCommand.newTree(
        newIdentNode("static"),
        newIdentNode("int")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDotExpr.newTree(
        nnkCall.newTree(
          nnkDotExpr.newTree(
            newIdentNode("T"),
            newIdentNode("getBigInt")
          )
        ),
        newIdentNode("bits")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getScalarField")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("EC"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("EC_ShortW_Aff")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Fr"),
        nnkDotExpr.newTree(
          nnkDotExpr.newTree(
            newIdentNode("EC"),
            newIdentNode("F")
          ),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("ECFFT_Descriptor")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("EC"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("order")
            ),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("rootsOfUnity")
            ),
            nnkPtrTy.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("UncheckedArray"),
                nnkBracketExpr.newTree(
                  newIdentNode("BigInt"),
                  nnkCall.newTree(
                    nnkDotExpr.newTree(
                      nnkCall.newTree(
                        newIdentNode("getScalarField"),
                        newIdentNode("EC")
                      ),
                      newIdentNode("bits")
                    )
                  )
                )
              )
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("new")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("ECFFT_Descriptor")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("main"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ctx"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkDotExpr.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("ECFFT_Descriptor"),
                nnkBracketExpr.newTree(
                  newIdentNode("EC_ShortW_Aff"),
                  nnkBracketExpr.newTree(
                    newIdentNode("Fp"),
                    newIdentNode("BLS12_381")
                  )
                )
              ),
              newIdentNode("new")
            )
          )
        )
      )
    )
  ),
  nnkCall.newTree(
    newIdentNode("main")
  )
)
1.0.10 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(39, 60) Error: type mismatch: got <type EC>
but expected one of: 
template getScalarField(EC: type EC_ShortW_Aff): untyped
  first type mismatch at position: 1
  required type for EC: type EC_ShortW_Aff
  but expression 'EC' is of type: type EC

expression: getScalarField(EC)

IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-07-18T13:01:59
  • Finished 2024-07-18T13:02:00
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("bitops")
    )
  ),
  nnkConstSection.newTree(
    nnkConstDef.newTree(
      newIdentNode("WordBitWidth"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("*"),
        nnkCall.newTree(
          newIdentNode("sizeof"),
          newIdentNode("pointer")
        ),
        newLit(8)
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("wordsRequired")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("bits"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("inline")
    ),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkConstSection.newTree(
        nnkConstDef.newTree(
          newIdentNode("divShiftor"),
          newEmptyNode(),
          nnkCall.newTree(
            newIdentNode("fastLog2"),
            nnkCall.newTree(
              newIdentNode("uint32"),
              newIdentNode("WordBitWidth")
            )
          )
        )
      ),
      nnkAsgn.newTree(
        newIdentNode("result"),
        nnkInfix.newTree(
          newIdentNode("shr"),
          nnkPar.newTree(
            nnkInfix.newTree(
              newIdentNode("-"),
              nnkInfix.newTree(
                newIdentNode("+"),
                newIdentNode("bits"),
                newIdentNode("WordBitWidth")
              ),
              newLit(1)
            )
          ),
          newIdentNode("divShiftor")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Algebra")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("BLS12_381")
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("BigInt")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("bits"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("limbs")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("array"),
              nnkCall.newTree(
                newIdentNode("wordsRequired"),
                newIdentNode("bits")
              ),
              newIdentNode("uint")
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fr")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(255)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Fp")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("residue_form")
            ),
            nnkBracketExpr.newTree(
              newIdentNode("BigInt"),
              newLit(381)
            ),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FF")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("Name"),
          nnkCommand.newTree(
            newIdentNode("static"),
            newIdentNode("Algebra")
          ),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("or"),
        nnkBracketExpr.newTree(
          newIdentNode("Fp"),
          newIdentNode("Name")
        ),
        nnkBracketExpr.newTree(
          newIdentNode("Fr"),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("EC_ShortW_Aff")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("F"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("x")
            ),
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("y")
            ),
            newIdentNode("F"),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("FieldKind")
      ),
      newEmptyNode(),
      nnkEnumTy.newTree(
        newEmptyNode(),
        newIdentNode("kBaseField"),
        newIdentNode("kScalarField")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getBigInt")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newCommentStmtNode("Get the underlying BigInt type."),
      nnkCall.newTree(
        newIdentNode("typeof"),
        nnkDotExpr.newTree(
          nnkCall.newTree(
            newIdentNode("default"),
            newIdentNode("T")
          ),
          newIdentNode("mres")
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("bits")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("Name"),
        nnkCommand.newTree(
          newIdentNode("static"),
          newIdentNode("Algebra")
        ),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkCommand.newTree(
        newIdentNode("static"),
        newIdentNode("int")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          nnkBracketExpr.newTree(
            newIdentNode("FF"),
            newIdentNode("Name")
          )
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDotExpr.newTree(
        nnkCall.newTree(
          nnkDotExpr.newTree(
            newIdentNode("T"),
            newIdentNode("getBigInt")
          )
        ),
        newIdentNode("bits")
      )
    )
  ),
  nnkTemplateDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("getScalarField")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("untyped"),
      nnkIdentDefs.newTree(
        newIdentNode("EC"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("EC_ShortW_Aff")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Fr"),
        nnkDotExpr.newTree(
          nnkDotExpr.newTree(
            newIdentNode("EC"),
            newIdentNode("F")
          ),
          newIdentNode("Name")
        )
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("ECFFT_Descriptor")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("EC"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("order")
            ),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            nnkPostfix.newTree(
              newIdentNode("*"),
              newIdentNode("rootsOfUnity")
            ),
            nnkPtrTy.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("UncheckedArray"),
                nnkBracketExpr.newTree(
                  newIdentNode("BigInt"),
                  nnkCall.newTree(
                    nnkDotExpr.newTree(
                      nnkCall.newTree(
                        newIdentNode("getScalarField"),
                        newIdentNode("EC")
                      ),
                      newIdentNode("bits")
                    )
                  )
                )
              )
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkFuncDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("new")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        nnkCommand.newTree(
          newIdentNode("type"),
          newIdentNode("ECFFT_Descriptor")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("main"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ctx"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkDotExpr.newTree(
              nnkBracketExpr.newTree(
                newIdentNode("ECFFT_Descriptor"),
                nnkBracketExpr.newTree(
                  newIdentNode("EC_ShortW_Aff"),
                  nnkBracketExpr.newTree(
                    newIdentNode("Fp"),
                    newIdentNode("BLS12_381")
                  )
                )
              ),
              newIdentNode("new")
            )
          )
        )
      )
    )
  ),
  nnkCall.newTree(
    newIdentNode("main")
  )
)
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.4
  • Created 2024-07-18T13:01:11Z
  • Comments 2
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

🤖 Bug found in 24 minutes bisecting 8 commits at 0 commits per second

@metagn
Copy link
Collaborator

metagn commented Aug 19, 2024

I have both this and #23855 working in a complicated PR (#23411) but in the test code of both issues I have defined getBigInt as:

template getBigInt*[Name: static Algebra](T: type FF[Name]): untyped =
  ## Get the underlying BigInt type.
  typeof(default(T).residue_form)

since in #23855 it's not defined and in this one it uses a .mres field which is actually undeclared.

Unfortunately only the code in the issues compile + the length of the bigint arrays are computed correctly, but the complex node in ECFFT_Descriptor doesn't get instantiated properly yet and breaks sigmatch when trying to match the ECFFT_Descriptor type against generic procs. Maybe that'll be sorted out as well but just a heads up that a new issue might be needed if things still don't work

@mratsim
Copy link
Collaborator Author

mratsim commented Aug 22, 2024

Wow, thanks, that seems like a very involved debugging session full of footguns.

@metagn
Copy link
Collaborator

metagn commented Aug 22, 2024

Yeah it took a while lol, I ended up needing to debug the compiler on constantine itself because the workaround for this issue broke too. I couldn't figure out that it was the niche interaction with sigmatch that couldn't instantiate it so I couldn't come up with simpler test code, and I didn't think the required change in semgnrc would even work because it completely breaks a lot of code if enabled in generic procs and not generic types.

Good news is I know why the remaining instantiation issue happens and have a fix for it in #23194, the compiler converts any expressions matching a static parameter (in this case a call with tyFromExpr matches bits: static int) into an nkStaticExpr with a tyStatic type, and static types for some reason completely avoid instantiation. We can get away with just avoiding this conversion if the type is tyFromExpr for this issue to work, but actually instantiating tyStatic fixes 1 issue completely rather than partially so I'll include it as well since it doesn't seem to break anything.

Araq pushed a commit that referenced this issue Aug 26, 2024
…n fixes (#24005)

fixes #4228, fixes #4990, fixes #7006, fixes #7008, fixes #8406, fixes
#8551, fixes #11112, fixes #20027, fixes #22647, refs #23854 and #23855
(remaining issue fixed), refs #8545 (works properly now with
`cast[static[bool]]` changed to `cast[bool]`), refs #22342 and #22607
(disabled tests added), succeeds #23194

Parameter and return type nodes in generic procs now undergo the same
`inGenericContext` treatment that nodes in generic type bodies do. This
allows many of the fixes in #22029 and followups to also apply to
generic proc signatures. Like #23983 however this needs some more
compiler fixes, but this time mostly in `sigmatch` and type
instantiations.

1. `tryReadingGenericParam` no longer treats `tyCompositeTypeClass` like
a concrete type anymore, so expressions like `Foo.T` where `Foo` is a
generic type don't look for a parameter of `Foo` in non-generic code
anymore. It also doesn't generate `tyFromExpr` in non-generic code for
any generic LHS. This is to handle a very specific case in `asyncmacro`
which used `FutureVar.astToStr` where `FutureVar` is generic.
2. The `tryResolvingStaticExpr` call when matching `tyFromExpr` in
sigmatch now doesn't consider call nodes in general unresolved, only
nodes with `tyFromExpr` type, which is emitted on unresolved expressions
by increasing `c.inGenericContext`. `c.inGenericContext == 0` is also
now required to attempt instantiating `tyFromExpr`. So matching against
`tyFromExpr` in proc signatures works in general now, but I'm
speculating it depends on constant folding in `semExpr` for statics to
match against it properly.
3. `paramTypesMatch` now doesn't try to change nodes with `tyFromExpr`
type into `tyStatic` type when fitting to a static type, because it
doesn't need to, they'll be handled the same way (this was a workaround
in place of the static type instantiation changes, only one of the
fields in the #22647 test doesn't work with it).
4. `tyStatic` matching now uses `inferStaticParam` instead of just range
type matching, so `Foo[N div 2]` can infer `N` in the same way `array[N
div 2, int]` can. `inferStaticParam` also disabled itself if the
inferred static param type already had a node, but `makeStaticExpr`
generates static types with unresolved nodes, so we only disable it if
it also doesn't have a binding. This might not work very well but the
static type instantiation changes should really lower the amount of
cases where it's encountered.
5. Static types now undergo type instantiation. Previously the branch
for `tyStatic` in `semtypinst` was a no-op, now it acts similarly to
instantiating any other type with the following differences:
- Other types only need instantiation if `containsGenericType` is true,
static types also get instantiated if their value node isn't a literal
node. Ideally any value node that is "already evaluated" should be
ignored, but I'm not sure of a better way to check this, maybe if
`evalConstExpr` emitted a flag. This is purely for optimization though.
- After instantiation, `semConstExpr` is called on the value node if
`not cl.allowMetaTypes` and the type isn't literally a `static` type.
Then the type of the node is set to the base type of the static type to
deal with `semConstExpr` stripping abstract types.
We need to do this because calls like `foo(N)` where `N` is `static int`
and `foo`'s first parameter is just `int` do not generate `tyFromExpr`,
they are fully typed and so `makeStaticExpr` is called on them, giving a
static type with an unresolved node.
narimiran pushed a commit that referenced this issue Sep 16, 2024
fixes #23406, closes #23854, closes #23855 (test code of both compiles
but separate issue exists), refs #23432, follows #23411

In generic bodies, previously all regular `nkCall` nodes like `foo(a,
b)` were directly treated as generic statements and delayed immediately,
but other call kinds like `a.foo(b)`, `foo a, b` etc underwent
typechecking before making sure they have to be delayed, as implemented
in #22029. Since the behavior for `nkCall` was slightly buggy (as in

However the vast majority of calls in generic bodies out there are
`nkCall`, and while there isn't a difference in the expected behavior,
this exposes many issues with the implementation started in #22029 given
how much more code uses it now. The portion of these issues that CI has
caught are fixed in this PR but it's possible there are more.

1. Deref expressions, dot expressions and calls to dot expressions now
handle and propagate `tyFromExpr`. This is most of the changes in
`semexprs`.
2. For deref expressions to work in `typeof`, a new type flag
`tfNonConstExpr` is added for `tyFromExpr` that calls `semExprWithType`
with `efInTypeof` on the expression instead of `semConstExpr`. This type
flag is set for every `tyFromExpr` type of a node that `prepareNode`
encounters, so that the node itself isn't evaluated at compile time when
just trying to get the type of the node.
3. Unresolved `static` types matching `static` parameters is now treated
the same as unresolved generic types matching `typedesc` parameters in
generic type bodies, it causes a failed match which delays the call
instantiation.
4. `typedesc` parameters now reject all types containing unresolved
generic types like `seq[T]`, not just generic param types by themselves.
(using `containsGenericType`)
5. `semgnrc` now doesn't leave generic param symbols it encounters in
generic type contexts as just identifiers, and instead turns them into
symbol nodes. Normally in generic procs, this isn't a problem since the
generic param symbols will be provided again at instantiation time (and
in fact creating symbol nodes causes issues since `seminst` doesn't
actually instantiate proc body node types).
But generic types can try to be instantiated early in `sigmatch` which
will give an undeclared identifier error when the param is not provided.
Nodes in generic types (specifically in `tyFromExpr` which should be the
only use for `semGenericStmt`) undergo full generic type instantiation
with `prepareNode`, so there is no issue of these symbols remaining as
uninstantiated generic types.
6. `prepareNode` now has more logic for which nodes to avoid
instantiating.
Subscripts and subscripts turned into calls to `[]` by `semgnrc` need to
avoid instantiating the first operand, since it may be a generic body
type like `Generic` in an expression like `Generic[int]`.
Dot expressions cannot instantiate their RHS as it may be a generic proc
symbol or even an undeclared identifier for generic param fields, but
have to instantiate their LHS, so calls and subscripts need to still
instantiate their first node if it's a dot expression.
This logic still isn't perfect and needs the same level of detail as in
`semexprs` for which nodes can be left as "untyped" for overloading/dot
exprs/subscripts to handle, but should handle the majority of cases.

Also the `efDetermineType` requirement for which calls become
`tyFromExpr` is removed and as a result `efDetermineType` is entirely
unused again.

(cherry picked from commit ab18962)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants