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

parser: Prepare assignability refactor #215

Merged
merged 5 commits into from
Oct 25, 2023
Merged

parser: Prepare assignability refactor #215

merged 5 commits into from
Oct 25, 2023

Conversation

juliaogris
Copy link
Member

In yet another attempt to wrangle the complexities around assignability, shave
off a bunch of preparatory commits:

  • Pre pare pkg/parser/types.go refactor by
    • moving combineTypes into it
    • removing sameComposite in favour of inlining
  • Add a missing godoc comment in parser
  • Fix whitespace in tests

@github-actions
Copy link

github-actions bot commented Oct 24, 2023

firebase-deployment: https://evy-lang--215-nz732yp9.web.app (250771d)

Copy link
Member

@camh- camh- left a comment

Choose a reason for hiding this comment

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

nit: Slight typo in first commit message "parser: Refactor combineTypes": pk/parser/type.go

But lovely other than minor nits barely worth mentioning.

🥦

}
for _, input := range inputs {
parser := newParser(input, testBuiltins())
_ = parser.parse()
assertNoParseError(t, parser, input)

assert.Equal(t, NONE_TYPE, UNTYPED_ARRAY.Sub)
Copy link
Member

Choose a reason for hiding this comment

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

The commit message says "fix whitespace", but you're removing an assertion. Was this an accident and you only meant to remove the blank line?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was on purpose, but I guess I can leave it in.

}
return combinedT
}

Copy link
Member

Choose a reason for hiding this comment

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

nit nit: extra blank line at EOF. It does get removed in the next commit though, so not really a worry

Refactor combineTypes from a method on the parser to a standalone function as
it makes no use of the parser. Move it to pkg/parser/type.go as it more
naturally fits there.
Remove sameComposite as it is only used in one place and can be inlined as a
oneliner.
Remove ILLEGAL type as it should never be exposed and handled internally.
Add missing godoc comment to Type.String(). It's a mystery why golangci-lint
hasn't picked up on this earlier.
Fix whitespace of evy source code in parser tests.
@juliaogris juliaogris merged commit 37203a3 into main Oct 25, 2023
3 checks passed
@juliaogris juliaogris deleted the assignability-prep branch October 25, 2023 01:54
juliaogris added a commit that referenced this pull request Oct 25, 2023
Refactor types.go to only use Equals and assignable methods for type. This
makes the code more readable and easier to maintain. Add a section on
assignability to the spec.

 ---

 Only the last commit is relevant, the others are covered by #215.

Pull-Request: #216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants