Skip to content
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

Type inference/checking for builtins #34

Open
phipsgabler opened this issue Dec 5, 2021 · 0 comments
Open

Type inference/checking for builtins #34

phipsgabler opened this issue Dec 5, 2021 · 0 comments

Comments

@phipsgabler
Copy link

The internal logic doesn't accept Core.Builtin types, for which return_types fails:

julia> map(tuple, NumericParser(Int))
ERROR: ArgumentError: argument is not a generic function
Stacktrace:
 [1] return_types(f::Any, types::Any, interp::Core.Compiler.NativeInterpreter)
   @ Base ./reflection.jl:1238
 [2] return_types
   @ ./reflection.jl:1236 [inlined]
 [3] infer_result_type(::Function, ::Type, ::NumericParser{TextParse.Numeric{Int64}, Int64}, ::String; throw_empty_union::Bool)
   @ CombinedParsers ~/.julia/packages/CombinedParsers/kbHhW/src/transformation.jl:330
 [4] map(::Function, ::NumericParser{TextParse.Numeric{Int64}, Int64}; throw_empty_union::Bool)
   @ CombinedParsers ~/.julia/packages/CombinedParsers/kbHhW/src/transformation.jl:284
 [5] map(::Function, ::NumericParser{TextParse.Numeric{Int64}, Int64})
   @ CombinedParsers ~/.julia/packages/CombinedParsers/kbHhW/src/transformation.jl:284
 [6] top-level scope
   @ REPL[6]:1

Expected result: a parser with return type Tuple{Int}.

(I know that map(x -> tuple(x), NumericParser(Int)) works instead, but that's rather redundant...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant