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
tfoo: class<T>{
init: func(){}
a: T
b: T{
get { a }
set(c){ a = c }
}
}
tbar := tfoo<Int> new()
the above code generates errors:
[lang/Backtrace] Falling back on execinfo.. (build extension if you want fancy backtraces)
[Exception in FunctionCallWriter]: Trying to write unresolved function gc_malloc(T size)
(SIGABRT) abort program
[lang/Backtrace] Falling back on execinfo.. (build extension if you want fancy backtraces)
./rock_pure/bin/rock(lang_Backtrace__BacktraceHandler_backtrace_impl+0x115) [0x55ec85]
./rock_pure/bin/rock(lang_Exception__Exception_getCurrentBacktrace+0x13) [0x54c443]
./rock_pure/bin/rock(lang_Exception___signalHandler+0x124) [0x54c594]
/usr/lib/libc.so.6(+0x339f0) [0x7fbf0d7239f0]
/usr/lib/libc.so.6(gsignal+0x37) [0x7fbf0d723967]
/usr/lib/libc.so.6(abort+0x16a) [0x7fbf0d724d3a]
./rock_pure/bin/rock(lang_Exception__Exception_throw_impl+0x43) [0x54d823]
./rock_pure/bin/rock(rock_backend_cnaughty_FunctionCallWriter__FunctionCallWriter_write_functionCall+0x9c1) [0x51c5a1]
but this works
tfoo: class<T>{
init: func(){}
a: T
tbar := tfoo<Int> new()
The text was updated successfully, but these errors were encountered:
Tbh, the fact that properties sometimes don't properly resolve what's inside of them is not a big surprise. Ever since PDFE syntax they've been kind of fragile..
It seems that properties are not properly implemented for generic class.
In normal class, it will geterate get_ and set_ function. But in generics, b: Int { get {a }} will be accessed just like a class member ( in my case, in defaults).
ok, finally get it.
VariableDecl generates expr for properties. This has been fixed.
But here comes another problem, accessing tbar a will return a reference of a(because it is a generic) instead of a itself.
Relate issue(almost the same reason): #804
the above code generates errors:
but this works
The text was updated successfully, but these errors were encountered: