Skip to content
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
3 changes: 2 additions & 1 deletion base/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,14 @@ macro constprop(setting)
end

function constprop_setting(@nospecialize setting)
s = setting
isa(setting, QuoteNode) && (setting = setting.value)
if setting === :aggressive
return :aggressive_constprop
elseif setting === :none
return :no_constprop
end
throw(ArgumentError(LazyString("@constprop "), setting, "not supported"))
throw(ArgumentError(LazyString("`Base.@constprop ", s, "` not supported")))
end

"""
Expand Down
12 changes: 12 additions & 0 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1575,3 +1575,15 @@ end
end
@test !occursin("loop not unrolled", out_err)
end

@testset "`@constprop`, `@assume_effects` handling of an unknown setting" begin
for x ∈ ("constprop", "assume_effects")
try
eval(Meta.parse("Base.@$x :unknown f() = 3"))
error("unexpectedly reached")
catch e
e::LoadError
@test e.error isa ArgumentError
end
end
end