-
Notifications
You must be signed in to change notification settings - Fork 0
Fixes tests that was broken with enhancements made to the lexer
#2
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
Conversation
* master: (32 commits) RFC: Return type overlap validation Tests for `NewDirectives()` for better coverage Clean up redundant code in `completeValueCatchingError` - `completeValue` would already have resolved the value for `func() interface{}` Add tests for type comparators Spec compliant @skip/@include. Fix bug where @include directive is ignored if @Skip is present. Test that `executor` threads `RootValue` correctly - Similar to `context` test Improve coercion error messages [RFC] Add explicit context arg to graphql execution Add GraphQLSchema types field Removed logs Follow up to: Move getTypeOf to executor and rename to defaultResolveTypeFn to mirror defaultResolveFn Add tests for default resolve function. Restored deprecated fields in `directives` in introspective query for coverage. Should be removed once `onOperation`, `onFragment`, `onField` are dropped from spec. Move getTypeOf to execute.js and rename to defaultResolveTypeFn to mirror defaultResolveFn Remove unused function parameters Remove unused function parameters Minor follow-up to graphql-go#311 [RFC] Add Schema Definition to IDL. Updating schema parser to more closely match current state of RFC ...
commit Matthias247@be39d41 - Running `go test` would have passed previously, but running all tests with `go test ./...` would fail. - Increased coverage for `lexer` package to 100% - Added more tests to cover parsing unicode strings (see graphql-go#135) as well.
Hi, |
Hi @Matthias247 Oops, let me explain :) Your The only relevant commit in this PR is 2762599 (I've fixed the The other commits would be gone after you merge in PR #1 (which will bring your After both PR #1 and #2 has been merged, I can close your original PR graphql-graphql-go#137 Hope that clears it up a little bit? Cheers! |
Ah, I see it now. But wouldn't it make much more sense to rebase the PR on current graphql-go/master and merge it then? I can do that. Merging the things here and merging the merged product back in the original repo sounds like duplicated merge of your commits. |
As an alternative you could also cherry pick my single lexer commit. |
Yeah thats the ideal way, please do that :) |
@sogko Rebased my PR on top of the current master branch. However that no misses the latest changes to the lexer that you made in the last commit here (e.g. fixing tests). |
if (end != bodyLength) && | ||
code, n := runeAt(body, endByte) | ||
if (endByte != bodyLength) && | ||
n == 1 && // only ASCII chars are allowed to be names |
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.
The n == 1 check is superfluos here, since the next and condition only checks for char codes which are all single-byte characters.
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.
Yeah, I agree, I'll remove that 👍
I have seen that you added functionality to also keep the current runeIndex in memory. I think that's ok. But I don't know if passing that to |
Yeah, I'm using the It certainly has limitations at the moment (for e.g. runes that are 3- and 4-bytes wide may not sit in one column, resulting the I didn't spend much time on that, it certainly would be nice to see this getting tackled. Do you want to address that in a separate PR? It would be related to ensuring a nice coverage over unicode support. (Current test suite are lacking that at the moment) |
…ing type - Removed unnecessary check of length of run in `readName()`
I think the most reasonable way to do this is to track the current line as well as in the Lexer to avoid the GetLocation call alltogether. The current implementation of GetLocation is quite costly, as it allocates a new string for each line. It could be replaced by a linear scan through the body to scan for line breaks and count columns. But as this is basically already done during lexing it would be redundant, especially if there are multiple errors. So the lexer would need to track multiple variables:
Sorry - don't have too much time to look into this now. For me the most imporant thing was to optimize the "happy path". |
So how should be proceed with this? Was your plan that I merge this and you merge the result back into graphql repo? If yes then this is PR refers the wrong branch, because my rebased changes are in the lexperf branch and not on the master branch. Otherwise you can simply merge my PR to the main graphql repo. And then merge your changes on top of it. |
Haha sure no problem, I'll put the improvement for I'll merge your PR to the main repo and push the updates on top of it 👌 Thanks for contributing your time on this, appreciate it very much! Cheers! |
Hi @Matthias247
The changes here includes changes in PR #1 (which updatesmatthias247/graphql:lexperf with latest changes from graphql-go/graphql:master). Merge that first before reviewing the changes here. 👍
Fixes tests that was broken with enhancements made to the
lexer
with commit be39d41go test
would have passed previously, but running all tests withgo test ./...
would fail.lexer
package to 100%This improvements made to the
lexer
in this branch do improve the perf by quite a bit (See separate discussion at sogko#22 (comment)). Would be glad to add it to v0.5.0 release.Cheers!