Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions jakttest/run_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def run_regular_test(params: RegularTestParams):
"-R",
params.runtime_path_for_stdlib,
params.cpp_export_gen,
"-I",
params.cpp_include
],
check=True,
stderr=stderr,
Expand All @@ -127,7 +129,7 @@ def run_regular_test(params: RegularTestParams):
"-Wno-user-defined-literals",
"-Wno-deprecated-declarations",
"-Iruntime",
params.cpp_include,
f"-I{params.cpp_include}",
params.cpp_export_include,
"-DJAKT_CONTINUE_ON_PANIC",
"-o",
Expand Down Expand Up @@ -246,7 +248,7 @@ def main():
relevant_cpp_files = [Path(test_file.parent, x).resolve() for x in args.cpp_link.split(":") if len(x) > 0]

if args.cpp_include:
cpp_include = f"-I{Path(test_file.parent, args.cpp_include)}"
cpp_include = f"{Path(test_file.parent, args.cpp_include)}"

if args.cpp_export_dir:
path = temp_dir / args.cpp_export_dir
Expand Down
4 changes: 3 additions & 1 deletion selfhost/cpp_import/clang.jakt
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,8 @@ class CppImportProcessor {
is_method and clang_CXXMethod_isStatic(cursor)
) or not is_method

let is_virtual = clang_CXXMethod_isVirtual(cursor)

if not this_type.has_value() and (kind is Constructor or kind is Destructor) {
if .debug_print { eprintln("[ICE] Constructor or destructor ({}) without a this type", name_from(cursor)) }
return
Expand Down Expand Up @@ -1907,7 +1909,7 @@ class CppImportProcessor {
is_instantiated: true
parsed_function: None
is_comptime: false
is_virtual: false
is_virtual: is_virtual
is_override: false
is_unsafe: false
has_varargs
Expand Down
4 changes: 4 additions & 0 deletions tests/typechecker/polymorphism_override_cpp_method.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Parent {
protected:
virtual void f() { AK::outln("From the parent"); };
};
14 changes: 14 additions & 0 deletions tests/typechecker/polymorphism_override_cpp_method.jakt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// Expect:
/// - output: "From the child\n"
/// - cppincludes: "."

import extern "polymorphism_override_cpp_method.h"

class Child : Parent {
public override fn f(mut this) { print("From the child\n"); }
}

fn main() {
mut c = Child()
c.f()
}
Loading