Skip to content

incorrect diagnostic: using a '.' after a '?.' might fail #1192

Closed
@vegerot

Description

@vegerot

minimal example:

undefined?.a.b

quick-lint reports: using a '.' after a '?.' might fail, since '?.' might return 'undefined'., however this is not true.

Running the above code shows that optional chaining short-circuits the entire property access expression to undefined, not just the first property access.

❯ deno
Deno 1.39.4
exit using ctrl+d, ctrl+c, or close()
REPL is running with all permissions allowed.
To specify permissions, run `deno repl` with allow flags.
> undefined?.a.b.c.d
undefined

idk if there's a "correct" version of this diagnostic, or if we should just delete the whole thing

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions