Skip to content

Commit

Permalink
Fix return type of DPI import tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed Apr 27, 2024
1 parent 3350030 commit 755e968
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/ast/symbols/SubroutineSymbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ SubroutineSymbol& SubroutineSymbol::fromSyntax(Compilation& compilation,
if (subroutineKind == SubroutineKind::Function)
result->declaredReturnType.setTypeSyntax(*proto.returnType);
else
result->declaredReturnType.setType(compilation.getIntType());
result->declaredReturnType.setType(compilation.getVoidType());

bool isPure = false;
switch (syntax.property.kind) {
Expand Down
20 changes: 20 additions & 0 deletions tests/unittests/ast/MemberTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2446,3 +2446,23 @@ endpackage
CHECK(diags[3].code == diag::Redefinition);
CHECK(diags[4].code == diag::PackageExportSelf);
}

TEST_CASE("DPI task import has correct return type") {
auto tree = SyntaxTree::fromText(R"(
module t;
task task1;
endtask
import "DPI-C" context task dpi_init;
initial begin
dpi_init;
task1;
end
endmodule
)");

Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}

0 comments on commit 755e968

Please sign in to comment.