Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyMorganz committed Jul 4, 2022
1 parent 278db12 commit e166fbc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/TypeInfer.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,4 +1003,27 @@ TEST_CASE_FIXTURE(Fixture, "do_not_bind_a_free_table_to_a_union_containing_that_
)");
}

TEST_CASE_FIXTURE(Fixture, "types stored in astResolvedTypes")
{
CheckResult result = check(R"(
type alias = typeof("hello")
local function foo(param: alias)
end
)");

auto node = findNodeAtPosition(*getMainSourceModule(), {2, 16});
auto ty = lookupType("alias");
REQUIRE(node);
REQUIRE(node->is<AstExprFunction>());
REQUIRE(ty);

auto func = node->as<AstExprFunction>();
REQUIRE(func->args.size == 1);

auto arg = *func->args.begin();
auto annotation = arg->annotation;

CHECK_EQ(*getMainModule()->astResolvedTypes.find(annotation), *ty);
}

TEST_SUITE_END();

0 comments on commit e166fbc

Please sign in to comment.