Skip to content

wrong referenced symbol in parameter intializer #26808

Closed

Description

TypeScript Version: 3.1.0-dev.20180831

Search Terms:

Code

// @target: ES2016
let foo = 1;
function test(bar = foo, foo = '') {}

Expected behavior:

foo in the initializer of bar references the parameter foo of type string.
Use before declare error for foo.

Actual behavior:

foo in the initializer of bar references the outer variable declaration foo of type number.
No use before declare error.
Exception when running this code.

Related Issues:
introduced by #26317 while trying to fix #22769
#26762

/cc Wenlu Wang (@Kingwl) again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions