-
Notifications
You must be signed in to change notification settings - Fork 25k
[Codegen 84] Merge Parse-Module-Name anon fn of Flow & TS parsers'
#36297
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
[Codegen 84] Merge Parse-Module-Name anon fn of Flow & TS parsers'
#36297
Conversation
packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js
Outdated
Show resolved
Hide resolved
Base commit: a49446b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pranav-yadav, thank you so much and great job!
I left a couple of comments that should be addressed before merging this PR.
Thank you again for the work you are putting into this!
packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js
Outdated
Show resolved
Hide resolved
cipolleschi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the commented test (see my comment for the why). I'll import and merge the PR.
Thank you for this work!
packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js
Outdated
Show resolved
Hide resolved
aaah... Exactly... I've spent hours debugging it (the generated ASTs 😞) and going through the base test cases but they couldn't help as they use fake manually created ASTs and not the actual one created by parser. PS: was going to add counter for "hours wasted here :(", jk Thanks. I'll rm that test. |
1db994a to
aa19750
Compare
cipolleschi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for taking care of this!
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
I see conflicts again... :( Rebasing quickly to fix :) |
- into a common `parseModuleName` fun in the `parsers-commons.js`
- in `parsers-commons-test.js` - related to: [Codegen 84]
…ror` in `parseModuleName` fn
- reason: The problem here is that;
```flow
export default TurboModuleRegistry.getEnforcing('SampleTurboModule');
```
this result in an `UntypedModuleRegistryCallParserError`, because it is "not generic".
The problem is that, to get a type for it, it "must" be a generic.
I can't think of any other way for `getEnforcing` to be typed with a different type rather than generic. 🤔
I don't think there is a way to create a valid Flow code which is typed with something that is not a generic.
I looked at the base test for that throw and they are manually creating an AST that satisfy that requirement,
but that AST probably can't be actually generated. 🤔
-- @cipolleschi
aa19750 to
2b6a831
Compare
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@cipolleschi merged this pull request in 05454fa. |
…#36297) Summary: Part of Umbrella facebook#34872 > [**Codegen 84** - assigned to Pranav-yadav] It depends on [Codegen 83] export the parseModuleName anonymous function (Flow, TypeScript) in a common parseModuleName function in the parsers-commons.js file. - merged Parse Module-Name _**anon**_ fn of `Flow` & `TS` parsers; into a common `parseModuleName` fn in the `parsers-commons.js` - added **tests** for `parseModuleName` fn from `parsers-commons.js` - added `callExpressionTypeParameters` method to **_parsers_** - added **tests** for `callExpressionTypeParameters` method of _parsers_ - used `parser.callExpressionTypeParameters` method in `parseModuleName` fn PS: fixed merge conflicts several times :( Overall :) ## Changelog [INTERNAL] [CHANGED] - Merge Parse-Module-Name anon fn of `Flow` & `TS` and add `callExpressionTypeParameters` method to **_parsers_** Pull Request resolved: facebook#36297 Test Plan: - `yarn lint && yarn run flow && yarn test react-native-codegen` ==> ✅ Reviewed By: rshest Differential Revision: D43694563 Pulled By: cipolleschi fbshipit-source-id: 99cf40ada0a567cd9ff91078f66fd4ac3684f7cc
Summary
Part of Umbrella #34872
Flow&TSparsers; into a commonparseModuleNamefn in theparsers-commons.jsparseModuleNamefn fromparsers-commons.jscallExpressionTypeParametersmethod to parserscallExpressionTypeParametersmethod of parsersparser.callExpressionTypeParametersmethod inparseModuleNamefnPS: fixed merge conflicts several times :(
Overall :)
Changelog
[INTERNAL] [CHANGED] - Merge Parse-Module-Name anon fn of
Flow&TSand addcallExpressionTypeParametersmethod to parsersTest Plan
yarn lint && yarn run flow && yarn test react-native-codegen==> ✅