https://github.com/JuliaLang/julia
Revision b2b713d8dc918221be4a43b12d0f08cff7635eb5 authored by Keno Fischer on 11 September 2022, 01:29:20 UTC, committed by N5N3 on 31 January 2023, 12:19:35 UTC
Core.Typeof is used implicitly in the system, but for types with
free type parameters, e.g. `Vector{Core.TypeVar(:T)}`, it expects
to subsequently be wrapped in a UnionAll. In particular, it is
not in general valid to perform type queries on the result of
`Core.Typeof` (without wrapping it in a UnionAll), but we were
attempting to do so in a number of places. Of course, this is a
bit of a rare sitatuation, since we're not in a habit of passing
around types with free typevars, but since those are valid objects
I think it is better to be defensive.

This introduces `Base.TypeofValid` (better name suggestions welcome),
which is like `Core.Typeof`, except that types with free typevars
get mapped to `DataType`, rather than `Type{}` with a free typevars.
As a result, it is always valid to perform type system operations
on the result of this call.
1 parent 94c4fb5
Raw File
Tip revision: b2b713d8dc918221be4a43b12d0f08cff7635eb5 authored by Keno Fischer on 11 September 2022, 01:29:20 UTC
Don't create Type{...} for incomplete types in most cases
Tip revision: b2b713d
builtin_proto.h
// This file is a part of Julia. License is MIT: https://julialang.org/license

#ifndef JL_BUILTIN_PROTO_H
#define JL_BUILTIN_PROTO_H

#ifdef __cplusplus
extern "C" {
#endif

// declarations for julia-callable builtin functions

#ifdef DEFINE_BUILTIN_GLOBALS
#define DECLARE_BUILTIN(name) \
    JL_CALLABLE(jl_f_##name); \
    JL_DLLEXPORT jl_value_t *jl_builtin_##name; \
    JL_DLLEXPORT jl_fptr_args_t jl_f_##name##_addr = &jl_f_##name
#else
#define DECLARE_BUILTIN(name) \
    JL_CALLABLE(jl_f_##name); \
    JL_DLLEXPORT extern jl_value_t *jl_builtin_##name; \
    JL_DLLEXPORT extern jl_fptr_args_t jl_f_##name##_addr
#endif

DECLARE_BUILTIN(applicable);
DECLARE_BUILTIN(_apply_iterate);
DECLARE_BUILTIN(_apply_pure);
DECLARE_BUILTIN(apply_type);
DECLARE_BUILTIN(arrayref);
DECLARE_BUILTIN(arrayset);
DECLARE_BUILTIN(arraysize);
DECLARE_BUILTIN(_call_in_world);
DECLARE_BUILTIN(_call_in_world_total);
DECLARE_BUILTIN(_call_latest);
DECLARE_BUILTIN(replacefield);
DECLARE_BUILTIN(const_arrayref);
DECLARE_BUILTIN(_expr);
DECLARE_BUILTIN(fieldtype);
DECLARE_BUILTIN(getfield);
DECLARE_BUILTIN(ifelse);
DECLARE_BUILTIN(invoke);
DECLARE_BUILTIN(is);
DECLARE_BUILTIN(isa);
DECLARE_BUILTIN(isdefined);
DECLARE_BUILTIN(issubtype);
DECLARE_BUILTIN(modifyfield);
DECLARE_BUILTIN(nfields);
DECLARE_BUILTIN(setfield);
DECLARE_BUILTIN(sizeof);
DECLARE_BUILTIN(svec);
DECLARE_BUILTIN(swapfield);
DECLARE_BUILTIN(throw);
DECLARE_BUILTIN(tuple);
DECLARE_BUILTIN(typeassert);
DECLARE_BUILTIN(_typebody);
DECLARE_BUILTIN(typeof);
DECLARE_BUILTIN(_typevar);
DECLARE_BUILTIN(donotdelete);
DECLARE_BUILTIN(compilerbarrier);
DECLARE_BUILTIN(getglobal);
DECLARE_BUILTIN(setglobal);
DECLARE_BUILTIN(finalizer);
DECLARE_BUILTIN(_compute_sparams);
DECLARE_BUILTIN(_svec_ref);

JL_CALLABLE(jl_f__structtype);
JL_CALLABLE(jl_f__abstracttype);
JL_CALLABLE(jl_f__primitivetype);
JL_CALLABLE(jl_f__setsuper);
JL_CALLABLE(jl_f__equiv_typedef);
JL_CALLABLE(jl_f_get_binding_type);
JL_CALLABLE(jl_f_set_binding_type);
JL_CALLABLE(jl_f__compute_sparams);
JL_CALLABLE(jl_f__svec_ref);
#ifdef __cplusplus
}
#endif

#endif
back to top