Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Conversion of quoted strings sometimes introduces extra comments when containing comment like syntax #237

Closed
IwanKaramazow opened this issue Jan 17, 2021 · 0 comments · Fixed by #238

Comments

@IwanKaramazow
Copy link
Contributor

The conversion from Reason to ReScript naively picks up // as comments.

input:

let x = {j|https://www.apple.com|j};
let x = {|https://www.apple.com|};
let x = {js|https://www.apple.com|js};

output:

let x = j`https://www.apple.com` //www.apple.com|j};
let x = `https://www.apple.com` //www.apple.com|};
let x = `https://www.apple.com` //www.apple.com|js};
IwanKaramazow pushed a commit that referenced this issue Jan 17, 2021
Fixes #237

The conversion from Reason to ReScript naively picks up `//` as comments inside quoted strings..

input:
```reason
let x = {j|https://www.apple.com|j};
let x = {|https://www.apple.com|};
let x = {js|https://www.apple.com|js};
```

output:
```rescript
let x = j`https://www.apple.com` //www.apple.com|j};
let x = `https://www.apple.com` //www.apple.com|};
let x = `https://www.apple.com` //www.apple.com|js};
```

This patch fixes this behaviour and doesn't produce any extra comments
IwanKaramazow added a commit that referenced this issue Jan 17, 2021
* Improve conversion of quoted strings from Reason.

Fixes #237

The conversion from Reason to ReScript naively picks up `//` as comments inside quoted strings..

input:
```reason
let x = {j|https://www.apple.com|j};
let x = {|https://www.apple.com|};
let x = {js|https://www.apple.com|js};
```

output:
```rescript
let x = j`https://www.apple.com` //www.apple.com|j};
let x = `https://www.apple.com` //www.apple.com|};
let x = `https://www.apple.com` //www.apple.com|js};
```

This patch fixes this behaviour and doesn't produce any extra comments

* Update CHANGELOG

Co-authored-by: Iwan <[email protected]>
kevinbarabash pushed a commit to kevinbarabash/rescript-compiler that referenced this issue Dec 24, 2021
* Improve conversion of quoted strings from Reason.

Fixes rescript-lang/syntax#237

The conversion from Reason to ReScript naively picks up `//` as comments inside quoted strings..

input:
```reason
let x = {j|https://www.apple.com|j};
let x = {|https://www.apple.com|};
let x = {js|https://www.apple.com|js};
```

output:
```rescript
let x = j`https://www.apple.com` //www.apple.com|j};
let x = `https://www.apple.com` //www.apple.com|};
let x = `https://www.apple.com` //www.apple.com|js};
```

This patch fixes this behaviour and doesn't produce any extra comments

* Update CHANGELOG

Co-authored-by: Iwan <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant