Skip to content

Commit 7cd0694

Browse files
committed
wip: inject scope with dependent sigma binders
1 parent fcbc016 commit 7cd0694

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

thorin/fe/ast.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ const Def* SigmaBndr::type(World& world) const {
5959
*/
6060

6161
void SigmaBndr::inject(Scopes& scopes, const Def* def) const {
62-
size_t n = num_bndrs();
63-
for (size_t i = 0; i != n; ++i) scopes.bind(bndr(i)->sym(), def->proj(n, i));
62+
for (size_t i = 0, e = num_bndrs(); i != e; ++i) {
63+
auto elem = def->proj(e, i);
64+
scopes.bind(bndr(i)->sym(), elem);
65+
bndr(i)->inject(scopes, elem);
66+
}
6467
}
6568

6669
} // namespace thorin::fe

thorin/fe/parser.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ std::unique_ptr<SigmaBndr> Parser::parse_sigma_bndr(Tracker track, Sym sym) {
517517

518518
scopes_.push();
519519
parse_list("sigma binder", Tok::Tag::D_bracket_l, [&]() {
520+
if (!bndrs.empty()) bndrs.back()->inject(scopes_, infers.back());
521+
520522
bndrs.emplace_back(parse_bndr("element of a sigma binder"));
521523
const auto& bndr = bndrs.back();
522524
auto type = bndr->type(world());

0 commit comments

Comments
 (0)