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

restrict dispatch of some custrom string macros to String #57781

Merged
merged 1 commit into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions base/int.jl
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ ERROR: LoadError: ArgumentError: invalid base 10 digit '.' in "123456789123.4"
[...]
```
"""
macro int128_str(s)
macro int128_str(s::String)
return parse(Int128, s)
end

Expand All @@ -662,7 +662,7 @@ ERROR: LoadError: ArgumentError: invalid base 10 digit '-' in "-123456789123"
[...]
```
"""
macro uint128_str(s)
macro uint128_str(s::String)
return parse(UInt128, s)
end

Expand Down Expand Up @@ -695,7 +695,7 @@ ERROR: ArgumentError: invalid number format _ for BigInt or BigFloat
depends on the value of the precision at the point when the function is
defined, **not** at the precision at the time when the function is called.
"""
macro big_str(s)
macro big_str(s::String)
message = "invalid number format $s for BigInt or BigFloat"
throw_error = :(throw(ArgumentError($message)))
if '_' in s
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Dates/src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ but creates the DateFormat object once during macro expansion.

See [`DateFormat`](@ref) for details about format specifiers.
"""
macro dateformat_str(str)
macro dateformat_str(str::String)
DateFormat(str)
end

Expand Down
2 changes: 1 addition & 1 deletion stdlib/Sockets/src/IPAddr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ julia> @ip_str "2001:db8:0:0:0:0:2:1"
ip"2001:db8::2:1"
```
"""
macro ip_str(str)
macro ip_str(str::String)
return parse(IPAddr, str)
end

Expand Down