facebook / facebook/flow

flow-remove-types produces invalid JS after non-latin characters

Open
#7,779 13 comments 4 reactions 0 assignees View on GitHub
bug parsing
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Flow version: 0.100.0

## Expected behavior

Given the following input:

```js
// @flow
// п
function foo(bar: number) {}
```

`flow-remove-types` should produce:

```js
//
// п
function foo(bar ) {}
```

## Actual behavior

It produces invalid JS:

```js
//
// п
function foo(bar: {}
```

The non-latin character is the trigger. Without it, it works correctly. This seems like quite a serious bug considering how common it is to use non-latin characters in comments (e.g. comment in other languages, draw arrows etc.).

cc @mroch @samwgoldman

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.