Skip to content

Instantly share code, notes, and snippets.

@quinnj
Created March 25, 2015 04:15
Show Gist options
  • Save quinnj/cf1e4e971d549dde8c7e to your computer and use it in GitHub Desktop.
Save quinnj/cf1e4e971d549dde8c7e to your computer and use it in GitHub Desktop.
JSON Compiler Error
julia> @code_typed parse_value(ps,true)
1-element Array{Any,1}:
:($(Expr(:lambda, Any[:ps,:ordered], Any[Any[:ch,symbol("#s19"),symbol("#s18"),symbol("#s14"),symbol("#s13"),symbol("#s12"),symbol("#s11"),:ret],Any[Any[:ps,JSON.Parser.ParserState{ASCIIString},0],Any[:ordered,Bool,0],Any[:ch,Char,18],Any[symbol("#s19"),Bool,2],Any[symbol("#s18"),Bool,18],Any[symbol("#s14"),Bool,2],Any[symbol("#s13"),Bool,18],Any[symbol("#s12"),Bool,18],Any[symbol("#s11"),Bool,2],Any[:ret,Any,34]],Any[],Any[Bool,Bool,Char,Char,Char,Char,Char,Char,Char,Char,Char,Char]], :(begin # none, line 2:
((top(getfield))((top(getfield))(JSON,:Parser),:chomp_space)::Any)(ps::JSON.Parser.ParserState{ASCIIString})::Void # line 3:
unless (top(slt_int))((top(getfield))(ps::JSON.Parser.ParserState{ASCIIString},:e)::Int64,(top(getfield))(ps::JSON.Parser.ParserState{ASCIIString},:s)::Int64)::Bool goto 0
return nothing
0: # line 5:
ch = ((top(getfield))((top(getfield))(JSON,:Parser),:charat)::Any)(ps::JSON.Parser.ParserState{ASCIIString})::Char # line 6:
GenSym(2) = '"'
unless (top(box))(UInt32,ch::Char) === (top(box))(UInt32,GenSym(2))::Bool goto 1 # line 7:
ret = ((top(getfield))((top(getfield))(JSON,:Parser),:parse_string)::Any)(ps::JSON.Parser.ParserState{ASCIIString})::Union(ASCIIString,UTF8String)
goto 14
1: # line 8:
GenSym(3) = '{'
unless (top(box))(UInt32,ch::Char) === (top(box))(UInt32,GenSym(3))::Bool goto 2 # line 9:
ret = ((top(getfield))((top(getfield))(JSON,:Parser),:parse_object)::Any)(ps::JSON.Parser.ParserState{ASCIIString},ordered::Bool)::Any
goto 14
2: # line 10:
GenSym(4) = '0'
unless (top(box))(Bool,(top(not_int))((top(ult_int))((top(box))(UInt32,ch::Char),(top(box))(UInt32,GenSym(4)))::Bool)) goto 3
GenSym(5) = '9'
#s19 = (top(box))(Bool,(top(not_int))((top(ult_int))((top(box))(UInt32,GenSym(5)),(top(box))(UInt32,ch::Char))::Bool))
goto 4
3:
#s19 = false
4:
unless #s19::Bool goto 5
#s14 = #s19::Bool
goto 7
5:
GenSym(6) = '-'
#s18 = (top(box))(UInt32,ch::Char) === (top(box))(UInt32,GenSym(6))::Bool
unless #s18::Bool goto 6
#s14 = #s18::Bool
goto 7
6:
GenSym(7) = '+'
#s14 = (top(box))(UInt32,ch::Char) === (top(box))(UInt32,GenSym(7))::Bool
7:
GenSym(0) = #s14::Bool
unless GenSym(0) goto 8 # line 11:
ret = ((top(getfield))((top(getfield))(JSON,:Parser),:parse_number)::Any)(ps::JSON.Parser.ParserState{ASCIIString})::Union(Int64,Float64)
goto 14
8: # line 12:
GenSym(8) = '['
unless (top(box))(UInt32,ch::Char) === (top(box))(UInt32,GenSym(8))::Bool goto 9 # line 13:
ret = ((top(getfield))((top(getfield))(JSON,:Parser),:parse_array)::Any)(ps::JSON.Parser.ParserState{ASCIIString},ordered::Bool)::Array{Any,1}
goto 14
9: # line 14:
GenSym(9) = 'f'
#s13 = (top(box))(UInt32,ch::Char) === (top(box))(UInt32,GenSym(9))::Bool
unless #s13::Bool goto 10
#s11 = #s13::Bool
goto 12
10:
GenSym(10) = 't'
#s12 = (top(box))(UInt32,ch::Char) === (top(box))(UInt32,GenSym(10))::Bool
unless #s12::Bool goto 11
#s11 = #s12::Bool
goto 12
11:
GenSym(11) = 'n'
#s11 = (top(box))(UInt32,ch::Char) === (top(box))(UInt32,GenSym(11))::Bool
12:
GenSym(1) = #s11::Bool
unless GenSym(1) goto 13 # line 15:
ret = ((top(getfield))((top(getfield))(JSON,:Parser),:parse_simple)::Any)(ps::JSON.Parser.ParserState{ASCIIString})::Union(Bool,Void)
goto 14
13: # line 17:
((top(getfield))((top(getfield))(JSON,:Parser),:_error)::Any)("Unknown value",ps::JSON.Parser.ParserState{ASCIIString})::Union()
14: # line 19:
return ret
end::Any))))
# code_llvm
julia> @code_llvm parse_value(ps,true)
ERROR: TypeError: instantiate_type: expected TypeConstructor, got Function
in _dump_function at reflection.jl:159
in code_llvm at reflection.jl:166
in code_llvm at reflection.jl:167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment