summaryrefslogtreecommitdiffstats
path: root/source/slang/check.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-12-27 20:17:36 -0500
committerGitHub <noreply@github.com>2017-12-27 20:17:36 -0500
commite370fe2984e7e260dc2d78d67b087e542d0102b0 (patch)
treedd441836025e802f79e74646f8f280c7515cbaec /source/slang/check.cpp
parent69242398be1ba76898c0d6541eec3b7ca0ec1ab4 (diff)
parentd55b56bc804f25d8390f1dc6b09ff9116ffcaf29 (diff)
Merge pull request #335 from csyonghe/master
Support nested generic types (e.g. L<T<S>>)
Diffstat (limited to 'source/slang/check.cpp')
-rw-r--r--source/slang/check.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index 9faad1127..5141d8634 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -7003,8 +7003,18 @@ namespace Slang
}
}
- // TODO: need to fill in constraints here...
-
+ // create default substitution arguments for constraints
+ for (auto mm : genericDecl->Members)
+ {
+ if (auto genericTypeConstraintDecl = mm.As<GenericTypeConstraintDecl>())
+ {
+ RefPtr<DeclaredSubtypeWitness> witness = new DeclaredSubtypeWitness();
+ witness->declRef = makeDeclRef(genericTypeConstraintDecl.Ptr());
+ witness->sub = genericTypeConstraintDecl->sub.type;
+ witness->sup = genericTypeConstraintDecl->sup.type;
+ subst->args.Add(witness);
+ }
+ }
return subst;
}
return parentSubst;