jashkenas / jashkenas/coffeescript
Bug: Block comments push last comment into import statements
- Dominant language
- CoffeeScript
- Stars
- 16.6k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
```coffee
### if there is a block comment before imports ###
log 'including if there are lines in between'
# last comment before import statement is moved into import
import { a } from 'foo'
```
Last 2 lines will compile to invalid Javascript:
```js
import {
// last comment before import statement is moved into import
a
} from 'foo';
```
Here are some permutations:
Ok:
```coffee
# line
import { a } from 'foo'
### block ###
```
```coffee
### block ###
import { a } from 'foo'
```
Fail:
```coffee
import { a } from 'foo'
### block pushed inside ###
# line pushed inside
import { b } from 'foo'
```
```coffee
### block NOT pushed inside ###
# line pushed inside
import { a } from 'foo'
```
* CoffeeScript version: 2.6.1
* Node.js version: 6.13.0
Contributor guide
Research direction
Reproduce the CoffeeScript 2.6.1 examples involving block comments, line comments, and consecutive imports, then trace the compiler's comment handling around import generation. Done means the failing permutations compile to valid JavaScript without moving comments inside the imported-name list, while the working permutations remain unchanged.
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
- Mostly clear
- Newbie friendliness
- 48/100