From 2ec7e7c88d498ea54bb1a254210cf6a90bd46ebb Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Sat, 10 Aug 2019 12:08:18 -0600 Subject: [PATCH] Fixes --- base/printf.jl | 10 +++++----- contrib/generate_precompile.jl | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/base/printf.jl b/base/printf.jl index 7966f716900b9..86e5196dc7b42 100644 --- a/base/printf.jl +++ b/base/printf.jl @@ -4,7 +4,7 @@ module Printf using .Base.Ryu -export @printf, @sprintf +export @printf, @sprintf, Format, format, @format const Ints = Union{Val{'d'}, Val{'i'}, Val{'u'}, Val{'x'}, Val{'X'}, Val{'o'}} const Floats = Union{Val{'e'}, Val{'E'}, Val{'f'}, Val{'F'}, Val{'g'}, Val{'G'}, Val{'a'}, Val{'A'}} @@ -118,7 +118,7 @@ function Format(f::AbstractString) pos += 1 end # parse type - !(b in b"diouxXDOUeEfFgGaAcCsSpn") && throw(ArgumentError("invalid format string: '$f'")) + !(b in b"diouxXDOUeEfFgGaAcCsSpn") && throw(ArgumentError("invalid format string: '$f', invalid type specifier: '$(Char(b))'")) type = Val{Char(b)} if type <: Ints && precision > 0 zero = false @@ -428,17 +428,17 @@ macro printf(io_or_fmt, fmt_or_first_arg, args...) if io_or_fmt isa String io = stdout fmt = Format(io_or_fmt) - return esc(:(Printf.format($io, $fmt, $fmt_or_first_arg, $(args...)))) + return esc(:(Base.Printf.format($io, $fmt, $fmt_or_first_arg, $(args...)))) else io = io_or_fmt fmt = Format(fmt_or_first_arg) - return esc(:(Printf.format($io, $fmt, $(args...)))) + return esc(:(Base.Printf.format($io, $fmt, $(args...)))) end end macro sprintf(fmt, args...) f = Format(fmt) - return esc(:(Printf.format($f, $(args...)))) + return esc(:(Base.Printf.format($f, $(args...)))) end end # module diff --git a/contrib/generate_precompile.jl b/contrib/generate_precompile.jl index abc25b2598001..81d262ca60576 100644 --- a/contrib/generate_precompile.jl +++ b/contrib/generate_precompile.jl @@ -137,7 +137,9 @@ function generate_precompile_statements() # Extract the precompile statements from stderr statements = Set{String}() for statement in eachline(precompile_file_h) - (occursin("Main.", statement) || occursin("Printf.", statement)) && continue + (occursin("Main.", statement) || + occursin("Printf.", statement) || + occursin("Base.io_has_tvar_name", statement)) && continue # check for `#x##s66` style variable names not in quotes occursin(r"#\w", statement) && count(r"(?:#+\w+)+", statement) !=