-
Notifications
You must be signed in to change notification settings - Fork 200
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 SchemaCompiler filterPrimaryKey #1915
Conversation
Maybe here? https://github.com/digitallyinduced/ihp/blob/master/Test/IDE/SchemaDesigner/CompilerSpec.hs |
Im not sure a file in |
You are right. Let's get Marc's feedback on that 😄 |
Thanks for the issue and the PR :) (and sorry for the delay in the review) We could put it into |
That sounds reasonable!👍🏻 |
getInstanceDecl errored if the instance that is searched for is at the end of file and doesn't have any newlines trailing it
@@ -460,4 +460,4 @@ getInstanceDecl instanceName full = | |||
takeInstanceDecl (line:rest) | |||
| isEmpty line = [] | |||
| otherwise = line : takeInstanceDecl rest | |||
takeInstanceDecl [] = error "never encountered newline?" | |||
takeInstanceDecl [] = [] -- EOF reached |
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.
I would like to draw attention to this change here
In the test cases the instance I am looking for is the last one in the generated code, which resulted in an error, even tho i think it's totally fine. That this results in an error looked like a simple oversight to me so I changed it - the tests still pass... However a second opinion would be great in cause this actually had a deeper reason.
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.
Looks good to me 👍
I think this is ready for review 😊 |
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.
Thanks 👍 looks great, will merge once tests have run through
@@ -460,4 +460,4 @@ getInstanceDecl instanceName full = | |||
takeInstanceDecl (line:rest) | |||
| isEmpty line = [] | |||
| otherwise = line : takeInstanceDecl rest | |||
takeInstanceDecl [] = error "never encountered newline?" | |||
takeInstanceDecl [] = [] -- EOF reached |
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.
Looks good to me 👍
I think this fixes the issue I described in #1914.
I would love to add unit tests for this, however I wasn't able to find the right place to put them - If unit tests are wanted here I'd love a little guidance.