diff options
author | Zahary Karadjov <zahary@gmail.com> | 2013-12-25 19:25:04 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2013-12-25 19:25:04 +0200 |
commit | 1d02f2ea531ad14f686a75c30af9228ba84fa194 (patch) | |
tree | 086123d4040d4de250147ae0faae4bc1c5e4e325 /compiler/ast.nim | |
parent | 299cefdc984ef756ffb8dabb4e961a8d2505104f (diff) | |
download | Nim-1d02f2ea531ad14f686a75c30af9228ba84fa194.tar.gz |
wip type class reforms (the compiler bootstraps fine)
* replace tfAny and tfAll with tyAnd and tyOr * integrate matchTypeClass into typeRel * introduce tyBuiltInTypeClass to handle types such as tuple, object, proc, etc
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r-- | compiler/ast.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 462bad24f..64f959fe2 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -339,6 +339,7 @@ type tyTypeClass tyParametricTypeClass # structured similarly to tyGenericInst # lastSon is the body of the type class + tyBuiltInTypeClass tyAnd tyOr tyNot @@ -349,7 +350,8 @@ const tyPureObject* = tyTuple GcTypeKinds* = {tyRef, tySequence, tyString} tyError* = tyProxy # as an errornous node should match everything - tyTypeClasses* = {tyTypeClass, tyParametricTypeClass, tyAnd, tyOr, tyNot, tyAnything} + tyTypeClasses* = {tyTypeClass, tyBuiltInTypeClass, + tyParametricTypeClass, tyAnd, tyOr, tyNot, tyAnything} type TTypeKinds* = set[TTypeKind] @@ -384,9 +386,6 @@ type # proc foo(T: typedesc, list: seq[T]): var T tfRetType, # marks return types in proc (used to detect type classes # used as return types for return type inference) - tfAll, # type class requires all constraints to be met (default) - tfAny, # type class requires any constraint to be met - tfNot, # type class with a negative check tfCapturesEnv, # whether proc really captures some environment tfByCopy, # pass object/tuple by copy (C backend) tfByRef, # pass object/tuple by reference (C backend) @@ -399,6 +398,7 @@ type tfHasShared, # type constains a "shared" constraint modifier somewhere tfHasMeta, # type has "typedesc" or "expr" somewhere; or uses '|' tfHasGCedMem, # type contains GC'ed memory + tfGenericTypeParam TTypeFlags* = set[TTypeFlag] |