Skip to content

Add type restrictions to Dir #15697

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

Merged

Conversation

Vici37
Copy link
Contributor

@Vici37 Vici37 commented Apr 21, 2025

This is the output of compiling cr-source-typer and running it with the below incantation:

CRYSTAL_PATH="./src" ./typer spec/std_spec.cr \
  --error-trace --exclude src/crystal/ \
  --stats --progress \
  --union-size-threshold 2 \
  --ignore-private-defs \
  --ignore-protected-defs \
  src/dir

This is related to #15682 .

src/dir/glob.cr Outdated
@@ -138,15 +138,15 @@ class Dir
record DirectoriesOnly
record ConstantEntry, path : String, merged : Bool
record EntryMatch, pattern : String do
def matches?(string) : Bool
def matches?(string : String) : Bool
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: This entire type is an internal implementation detail. I don't think a type restriction matters here.

src/dir/glob.cr Outdated
File.match?(pattern, string)
end
end
record RecursiveDirectories
record ConstantDirectory, path : String
record RootDirectory
record DirectoryMatch, pattern : String do
def matches?(string) : Bool
def matches?(string : String) : Bool
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@straight-shoota straight-shoota added this to the 1.17.0 milestone Apr 24, 2025
@straight-shoota straight-shoota changed the title Add type restrictions to Dir directory Add type restrictions to Dir Apr 30, 2025
@straight-shoota straight-shoota merged commit 64a773a into crystal-lang:master Apr 30, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants