-
-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependent default types #4452
Comments
This isn't an actionable bug. In keeping with our getting help documentation, please ask "how do I" questions in the Zulip. |
Closing |
Apologies for not making myself clear. What I meant is that the following code compiles (I changed the example a bit): actor Main
new create(env: Env) =>
Foo[U8, Array[U8]](env, 10)(3)
class Foo[T: Stringable val, Arr: Seq[T] ref = Array[T]]
let _env: Env
var arr: Arr = Arr
new create(env: Env, v: T) =>
_env = env
arr.push(v)
fun ref apply(v: T) =>
arr.push(v)
for el in arr.values() do
_env.out.print(el.string())
end whilst omitting the second generic type when instantiating - to leverage the default type, the compiler gives an error: actor Main
new create(env: Env) =>
Foo[U8](env, 10)(3)
class Foo[T: Stringable val, Arr: Seq[T] ref = Array[T]]
let _env: Env
var arr: Arr = Arr
new create(env: Env, v: T) =>
_env = env
arr.push(v)
fun ref apply(v: T) =>
arr.push(v)
for el in arr.values() do
_env.out.print(el.string())
end No problems to revert to Zulip, happy to do so if this is expected behavior. Thanks! |
This is definitely something that I would have expected to work as desired. The key issue here is that the compiler is comparing the constraint We discussed this a bit in the sync call today, but haven't done any triaging yet into why this doesn't work as expected today. Needs further troubleshooting. |
I also have a question about the possibility of using default types referencing other generic types in the same object. This code won't compile.
The rest of the code apparently is fine, as explicitly associating the type in the function body shows.
Thanks!
The text was updated successfully, but these errors were encountered: