Skip to content

fix: Certain comments cause generator exceptions#14810

Merged
JLHwung merged 2 commits intobabel:mainfrom
liuxingbaoyu:fix-gen-comment
Aug 4, 2022
Merged

fix: Certain comments cause generator exceptions#14810
JLHwung merged 2 commits intobabel:mainfrom
liuxingbaoyu:fix-gen-comment

Conversation

@liuxingbaoyu
Copy link
Copy Markdown
Member

@liuxingbaoyu liuxingbaoyu commented Jul 29, 2022

Q                       A
Fixed Issues? Fixes #14809
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass?
Documentation PR Link
Any Dependency Changes?
License MIT

@liuxingbaoyu liuxingbaoyu added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: generator i: regression labels Jul 29, 2022
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Jul 29, 2022

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52658/

val = `//${comment.value}\n`;
maybeNewline = true;
} else {
val = `/*${comment.value}*/`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is for when we had a line comment but we cannot have a line terminator? When can it happen?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in the associated issue. I also added to the test.
You said that and it reminded me that it doesn't contain newlines!😄

Copy link
Copy Markdown
Member Author

@liuxingbaoyu liuxingbaoyu Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing doesn't seem to reflect this.😕

Tested on my local.

const test = (): {
  /* test*/foo: string;
} => {
  return {
    foo: "bar"
  };
};

export default test;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#14758
#14762

Oh no, after a long time, I finally found the reason.
Only the first pr was published, and the second was not.

So this test is useless, we need to find another one.

By the way, can you release a new version of jest-light-runner?
Filtering of tests can be helpful in debugging generators and parsers.

@JLHwung JLHwung merged commit bee081d into babel:main Aug 4, 2022
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Nov 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: generator PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: parse return type with comments fail with @babel/generator

4 participants