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

Fix check for file type #13760

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Aug 19, 2023

A resolved require path does not just need to exist, it also needs to be a file. Otherwise there will be confusion when there's a folder with the same name of a potential path.

Resolves #8665

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Aug 19, 2023
@straight-shoota straight-shoota self-assigned this Aug 19, 2023
@HertzDevil
Copy link
Contributor

Can it be other kinds of files like #13853? I assume that makes little sense for require?

@straight-shoota
Copy link
Member Author

Yeah, in contrast to CLI arguments, I don't think pipes or character devices are very useful for require. We could consider broadening this, but changing exists? to file? is an upright no-brainer. It covers the most relevant usage and fixes a reported bug.
Additional edge cases should be discussed separately.

@straight-shoota straight-shoota added this to the 1.11.0 milestone Oct 16, 2023
@straight-shoota straight-shoota merged commit 7d969a4 into crystal-lang:master Oct 18, 2023
@straight-shoota straight-shoota deleted the fix/compiler-path-check-file branch October 18, 2023 10:01
Blacksmoke16 pushed a commit to Blacksmoke16/crystal that referenced this pull request Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler bug when requiring module
2 participants