Skip to content

Commit

Permalink
Add a fake block arg to <unresolved-ancestors> so that it passes sani…
Browse files Browse the repository at this point in the history
…ty checks (sorbet#5323)
  • Loading branch information
elliottt authored Feb 17, 2022
1 parent c3035c9 commit b324658
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resolver/resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,11 @@ class ResolveConstantsWalk {
core::make_type<core::UnresolvedClassType>(unresolvedPath->first, move(unresolvedPath->second));

auto uaSym = ctx.state.enterMethodSymbol(core::Loc::none(), item.klass, core::Names::unresolvedAncestors());

// Add a fake block argument so that this method symbol passes sanity checks
auto &arg = ctx.state.enterMethodArgumentSymbol(core::Loc::none(), uaSym, core::Names::blkArg());
arg.flags.isBlock = true;

core::TypePtr resultType = uaSym.data(ctx)->resultType;
if (!resultType) {
uaSym.data(ctx)->resultType = core::make_type<core::TupleType>(vector<core::TypePtr>{ancestorType});
Expand Down

0 comments on commit b324658

Please sign in to comment.