Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Certain comments cause generator exceptions #14810

Merged
merged 2 commits into from Aug 4, 2022

Conversation

liuxingbaoyu
Copy link
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
Collaborator

babel-bot commented Jul 29, 2022

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

}
} else if (!this._noLineTerminator) {
val = `//${comment.value}\n`;
maybeNewline = true;
} else {
val = `/*${comment.value}*/`;
Copy link
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
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
Member Author

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
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