You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, the typechecking is correct. It inferred correctly that I have created a SecretHolder<i32>, and that SecretHolder::create does not throw. The problem is that codegen did not add the template arguments in SecretHolder<T>::create, and this confuses clang++:
❯ clang++ -w -I. -I<path/to/runtime> test.cpp -std=c++20
test.cpp:18:34: error: 'SecretHolder' is not a class, namespace, or enumeration
const SecretHolder<i32> holder = SecretHolder::create(static_cast<i32>(42));
^
test.cpp:4:29: note: 'SecretHolder' declared here
template <typename T>struct SecretHolder {
^
1 error generated.
Clang fails at recognizing SecretHolder as a struct, since it's really a template.
The correct behavior should use SecretHolder<i32>::create(static_cast<i32>), i.e instantiating the template explicitly.
EDIT: simplified sample snippet to contain just Jakt code.
The text was updated successfully, but these errors were encountered:
Tracked it down to typechecker not filling the namespace.generic_parameters attribute in the resolved namespace. I tried checking if the last namespace was a struct then reference its generic_parameters array, but this doesn't resolve the T.
Let's say I have the following Jakt code:
It will typecheck and generate:
Here, the typechecking is correct. It inferred correctly that I have created a
SecretHolder<i32>
, and thatSecretHolder::create
does not throw. The problem is that codegen did not add the template arguments inSecretHolder<T>::create
, and this confuses clang++:Clang fails at recognizing
SecretHolder
as a struct, since it's really a template.The correct behavior should use
SecretHolder<i32>::create(static_cast<i32>)
, i.e instantiating the template explicitly.EDIT: simplified sample snippet to contain just Jakt code.
The text was updated successfully, but these errors were encountered: