diff --git a/frontend/test/resolution/testClasses.cpp b/frontend/test/resolution/testClasses.cpp index 164504b586f7..632a9ada1132 100644 --- a/frontend/test/resolution/testClasses.cpp +++ b/frontend/test/resolution/testClasses.cpp @@ -165,11 +165,19 @@ static void test4() { setupModuleSearchPaths(context, false, false, {}, {}); std::string program = R"""( + class C { var y : int; } + proc foo(arg: _owned) { } - // compiler-generate 'borrow' method - class C { var y : int; } + proc bar(arg: owned) { + } + + proc baz(type arg: _owned(C)) { + } + + proc buz(type arg: owned C) { + } var obj = new C(5); var x = obj.borrow(); @@ -182,6 +190,9 @@ static void test4() { var obj4 = new C(42); foo(obj4); + bar(obj4); + baz(obj4.type); + buz(obj4.type); )"""; @@ -191,7 +202,7 @@ static void test4() { auto init = var->initExpression(); assert(init); auto qt = results.byAst(init).type(); - auto c = m->stmt(2)->toClass(); + auto c = m->stmt(0)->toClass(); assert(c); auto it = initialTypeForTypeDecl(context, c->id()); auto bct = it->getCompositeType()->toBasicClassType(); @@ -199,11 +210,10 @@ static void test4() { auto borrowedNonNil = ClassType::get(context, bct, nullptr, ClassTypeDecorator( - ClassTypeDecorator::BORROWED_NONNIL)); + ClassTypeDecorator::BORROWED_NONNIL)); assert(qt.type() == borrowedNonNil); - - assert(guard.numErrors() == 0); + assert(guard.realizeErrors() == 0); } // test that we can map _shared to shared