Skip to content

function pointers with some names may couse to endless compilation #1652

Closed
@MaxGraey

Description

@MaxGraey

example:

export function test(): void {
  function fnDecl(val: i32): i32 {
    return val;
  }

  const exprDecl = function fnDecl(val: i64): i64 { // <- fnDecl function name
    return val;
  }

  const fn32 = [fnDecl];
  const fn64 = [exprDecl];
}

this cause to error:

export function test(): void {
  function fnDecl(val: i32): i32 {
    return val;
  }

  const exprDecl = function (val: i64): i64 {
    return val;
  }

  const fn32 = [fnDecl];
  const fn64 = [exprDecl];
}

output:

ERROR TS2304: Cannot find name 'fnDecl'.
;; 
;;    const fn32 = [fnDecl];
;;                  ~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions