jashkenas / jashkenas/coffeescript

Comment gets lost inside a function when using an existential operator

Open
#5,415 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
CoffeeScript
Stars
16.6k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

```coffee
->
#@ts-ignore
subsystem.clearCache?()
```

Actual

```js
// Generated by CoffeeScript 2.6.1
(function() {
return typeof subsystem.clearCache === "function" ? subsystem.clearCache() : void 0;
});
```

Expected

```js
// Generated by CoffeeScript 2.6.1
(function() {
//@ts-ignore
return typeof subsystem.clearCache === "function" ? subsystem.clearCache() : void 0;
});
```

Contributor guide

Open the contributing guide

Research direction

Start by compiling the provided CoffeeScript snippet with CoffeeScript 2.6.1 and compare the generated JavaScript with the expected output. Trace how the comment is handled around the existential operator, then add coverage showing that the comment is retained before the generated return statement.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.