-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Base
: macro cmd
: restrict argument to String
#57862
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
KristofferC
merged 2 commits into
JuliaLang:master
from
nsajko:Base_restrict_macro_cmd_argument_to_String
Mar 25, 2025
Merged
Base
: macro cmd
: restrict argument to String
#57862
KristofferC
merged 2 commits into
JuliaLang:master
from
nsajko:Base_restrict_macro_cmd_argument_to_String
Mar 25, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Should make the sysimage less vulnerable to invalidation. As far as I understand this change can't break any code, because: * the macro definition requires `AbstractString` * the way Julia macros work, the argument is either a literal or an `Expr` * `String` is the only `AbstractString` with literals
Base
: macro cmd
restrict argument to String
Base
: macro cmd
: restrict argument to String
Reduces the invalidation count on loading TypeDomainNaturalNumbers v7.0.0 from 739 to 731, preventing these invalidations: {
"method_instance": {
"method": "iterate(x::Base.Iterators.IterableStatePairs, state) @ Base.Iterators iterators.jl:1586",
"method_instance": "MethodInstance for iterate(::Base.Iterators.IterableStatePairs{T} where T<:SubString, ::Any)"
},
"children": [
{
"method_instance": {
"method": "popfirst!(s::Base.Iterators.Stateful) @ Base.Iterators iterators.jl:1487",
"method_instance": "MethodInstance for popfirst!(::Base.Iterators.Stateful{T} where T<:(Base.Iterators.IterableStatePairs{T} where T<:SubString))"
},
"children": [
{
"method_instance": {
"method": "iterate(s::Base.Iterators.Stateful, state) @ Base.Iterators iterators.jl:1502",
"method_instance": "MethodInstance for iterate(::Base.Iterators.Stateful{T} where T<:(Base.Iterators.IterableStatePairs{T} where T<:SubString), ::Nothing)"
},
"children": [
{
"method_instance": {
"method": "iterate(s::Base.Iterators.Stateful) @ Base.Iterators iterators.jl:1502",
"method_instance": "MethodInstance for iterate(::Base.Iterators.Stateful{T} where T<:(Base.Iterators.IterableStatePairs{T} where T<:SubString))"
},
"children": [
{
"method_instance": {
"method": "var\"#shell_parse#475\"(special::AbstractString, filename, ::typeof(Base.shell_parse), str::AbstractString, interpolate::Bool) @ Base shell.jl:31",
"method_instance": "MethodInstance for Base.var\"#shell_parse#475\"(::String, ::String, ::typeof(Base.shell_parse), ::AbstractString, ::Bool)"
},
"children": [
{
"method_instance": {
"method": "kwcall(::NamedTuple, ::typeof(Base.shell_parse), str::AbstractString, interpolate::Bool) @ Base shell.jl:31",
"method_instance": "MethodInstance for Core.kwcall(::@NamedTuple{special::String, filename::String}, ::typeof(Base.shell_parse), ::AbstractString, ::Bool)"
},
"children": [
{
"method_instance": {
"method": "kwcall(::NamedTuple, ::typeof(Base.shell_parse), str::AbstractString) @ Base shell.jl:31",
"method_instance": "MethodInstance for Core.kwcall(::@NamedTuple{special::String, filename::String}, ::typeof(Base.shell_parse), ::AbstractString)"
},
"children": [
{
"method_instance": {
"method": "var\"@cmd\"(__source__::LineNumberNode, __module__::Module, str) @ Base cmd.jl:507",
"method_instance": "MethodInstance for Core.var\"@cmd\"(::LineNumberNode, ::Module, ::Any)"
},
"children": [
]
}
]
}
]
}
]
}
]
},
{
"method_instance": {
"method": "var\"#shell_parse#475\"(special::AbstractString, filename, ::typeof(Base.shell_parse), str::AbstractString, interpolate::Bool) @ Base shell.jl:31",
"method_instance": "MethodInstance for Base.var\"#shell_parse#475\"(::String, ::String, ::typeof(Base.shell_parse), ::AbstractString, ::Bool)"
},
"children": [
]
}
]
},
{
"method_instance": {
"method": "var\"#shell_parse#475\"(special::AbstractString, filename, ::typeof(Base.shell_parse), str::AbstractString, interpolate::Bool) @ Base shell.jl:31",
"method_instance": "MethodInstance for Base.var\"#shell_parse#475\"(::String, ::String, ::typeof(Base.shell_parse), ::AbstractString, ::Bool)"
},
"children": [
]
}
]
}
]
} |
A more minimal reproducer than struct Z <: Integer end
Base.:(+)(n::Int, ::Z) = n |
KristofferC
pushed a commit
that referenced
this pull request
Mar 26, 2025
Should make the sysimage less vulnerable to invalidation. As far as I understand this change can't break any code, because: * the macro definition requires `AbstractString` * the way Julia macros work, the argument is either a literal or an `Expr` * `String` is the only `AbstractString` with literals (cherry picked from commit 7acb2a6)
KristofferC
pushed a commit
that referenced
this pull request
Mar 31, 2025
Should make the sysimage less vulnerable to invalidation. As far as I understand this change can't break any code, because: * the macro definition requires `AbstractString` * the way Julia macros work, the argument is either a literal or an `Expr` * `String` is the only `AbstractString` with literals (cherry picked from commit 7acb2a6)
KristofferC
pushed a commit
that referenced
this pull request
Mar 31, 2025
Should make the sysimage less vulnerable to invalidation. As far as I understand this change can't break any code, because: * the macro definition requires `AbstractString` * the way Julia macros work, the argument is either a literal or an `Expr` * `String` is the only `AbstractString` with literals (cherry picked from commit 7acb2a6)
KristofferC
pushed a commit
that referenced
this pull request
Mar 31, 2025
Should make the sysimage less vulnerable to invalidation. As far as I understand this change can't break any code, because: * the macro definition requires `AbstractString` * the way Julia macros work, the argument is either a literal or an `Expr` * `String` is the only `AbstractString` with literals (cherry picked from commit 7acb2a6)
KristofferC
pushed a commit
that referenced
this pull request
Jun 5, 2025
Should make the sysimage less vulnerable to invalidation. As far as I understand this change can't break any code, because: * the macro definition requires `AbstractString` * the way Julia macros work, the argument is either a literal or an `Expr` * `String` is the only `AbstractString` with literals (cherry picked from commit 7acb2a6)
KristofferC
pushed a commit
that referenced
this pull request
Jul 3, 2025
Should make the sysimage less vulnerable to invalidation. As far as I understand this change can't break any code, because: * the macro definition requires `AbstractString` * the way Julia macros work, the argument is either a literal or an `Expr` * `String` is the only `AbstractString` with literals (cherry picked from commit 7acb2a6)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Should make the sysimage less vulnerable to invalidation.
As far as I understand this change can't break any code, because:
AbstractString
Expr
String
is the onlyAbstractString
with literals