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

Crystal 0.36.0 support #4

Merged
merged 11 commits into from
Jan 28, 2021
Merged

Crystal 0.36.0 support #4

merged 11 commits into from
Jan 28, 2021

Conversation

kimburgess
Copy link
Contributor

Adds (partial) support for crystal 0.36.0 along with some better test coverage.

Core functionality remains, however static resolution of keys accessed via a non-strict lookup ([]?) in not possible due to stricter macro name checks.

Support tracking both compile-time and runtime access to keys.

Removes leakage of internal ACCESSED array to prevent accidental (or
malicous) mutation.
Provides partial support for crystal 0.36.0 to work around unexpected
compiler behaviour introduced by crystal-lang/crystal#10069.
@kimburgess kimburgess requested a review from caspiano January 27, 2021 14:20
@kimburgess kimburgess linked an issue Jan 27, 2021 that may be closed by this pull request
@stakach
Copy link
Member

stakach commented Jan 27, 2021

nice, it looks like your pull to re-introduce []? has legs, which is good
hopefully they release 0.36.1 soon

src/secrets-env.cr Outdated Show resolved Hide resolved
@caspiano
Copy link
Contributor

Version bump and LGTM

@caspiano
Copy link
Contributor

I'm getting this type error

 47 | def self.accessed(static_only = false) : Enumerable(String)
                                               ^
Error: method ENV.accessed must return Enumerable(String) but it is returning (Array(String) | Tuple())

@kimburgess
Copy link
Contributor Author

Nice catch! Spec interacts with the ENV module so I don't think it's possible to add a test case to cover that scenario. dc5691f should address the cause though.

Copy link
Member

@stakach stakach left a comment

Choose a reason for hiding this comment

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

LGTM

@caspiano
Copy link
Contributor

One more

 28 | ENV.accessed.sort.each &->puts(String)
                   ^---
Error: undefined method 'sort' for StaticArray(String, 0) (compile-time type is (Array(String) | StaticArray(String, 0)))

@caspiano caspiano merged commit bb4c7d3 into master Jan 28, 2021
@caspiano caspiano deleted the fix/crystal-compat branch January 28, 2021 03:37
@kimburgess kimburgess mentioned this pull request Feb 2, 2021
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.

0.36.0 - compiler error: macro []?(key) invalid macro name
3 participants