Skip to content

Precompile statements invalid for value types #38902

Open

Description

When using --trace-compile with Julia 1.7.0-DEV.77 (80ace52) I can use the following code:

using Dates
f(::Val{Hour(1)}) = ""
f(Val(Hour(1)))

to generate this precompile statement:

precompile(Tuple{typeof(Main.f), Base.Val{Dates.Hour(value=1)}})

Attempting to use this precompile statement values as Hour doesn't have a keyword constructor:

ERROR: MethodError: no method matching Hour(; value=1)
Closest candidates are:
  (::Type{T})(::Period) where T<:Period at /Users/omus/Development/Julia/latest/usr/share/julia/stdlib/v1.7/Dates/src/periods.jl:404 got unsupported keyword argument "value"
  Hour(::Number) at /Users/omus/Development/Julia/latest/usr/share/julia/stdlib/v1.7/Dates/src/types.jl:34 got unsupported keyword argument "value"
  Hour(::AbstractString) at /Users/omus/Development/Julia/latest/usr/share/julia/stdlib/v1.7/Dates/src/periods.jl:23 got unsupported keyword argument "value"
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[3]:1

Related to: #28808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorcompiler:precompilationPrecompilation of modulesdisplay and printingAesthetics and correctness of printed representations of objects.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions