| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
| |
Classes of the same EvalUtils.getSkylarkType are once again the same for the
type inferencer.
Also, for debugging purposes, only print SkylarkClassObject as struct, not all classes that implement ClassObject yet are considered disjoint by the type engine.
--
MOS_MIGRATED_REVID=87933890
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=87698104
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=87535290
|
|
|
|
|
|
|
|
|
|
|
| |
Fix race condition in SkylarkType.of(), whereby .equals() but not same (==) types were created, by making Simple.of() synchronized.
Also make SkylarkType#includes() more robust by using .equals() instead of == (it's a little bit slower in the case of Simple types once fixed, but also works on complex types that don't hash-cons their values).
Also, distinguish SkylarkList (printed as list) and java.util.List (printed as List) and similarly for tuple vs Tuple, when printing types in debugging messages.
--
MOS_MIGRATED_REVID=87490176
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=87342725
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactor SkylarkType, notably adding Union types and runtime typechecks.
These are pre-requisites to unifying all Skylark function calls to use the same
code path, that will check types (like SkylarkFunction currently does) as well
handle a more complete Python calling convention (like MixedModeFunction is
almost but not quite able to do).
A SkylarkType can be either
* a Simple type corresponding to a Java class, with special types TOP and BOTTOM
corresponding respectively to Object and EmptyType (similar to Void).
* a Combination of a generic class (LIST, MAP or SET) and an argument type
* a Union of a finite number of types
* a FunctionType associated with a name and a returnType (with ugly
validation-time side-effects that we should probably move out of the type)
Unions are necessary because:
1- the type of some builtin function arguments are actually the Union of some
type and a function type for a callback that computes the actual value.
2- the type of some builtin function arguments declared as "List" is actually
the Union of java List and SkylarkList.
3- instead of adding lots of special cases at the point of argument validation,
it's cleaner and more generally useful to have explicit Union types, that can
then be displayed to users for documentation or debugging purposes.
Validation-time "type inference" is re-expressed simply as type intersection.
None is treated specially as inferred into TOP instead of NoneType.
Combination types are printed as genericType of argTypes, e.g. "dict of ints". "type" and "generic1" become "genericType" and "argType". In SkylarkList and SkylarkNestedSet, genericType becomes contentType.
--
MOS_MIGRATED_REVID=87340881
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=87248208
|
|
|
|
|
|
|
| |
TestCase for it.
--
MOS_MIGRATED_REVID=87246613
|
|
--
MOS_MIGRATED_REVID=87244284
|