Comments (4)
This isn't an actionable bug. In keeping with our getting help documentation, please ask "how do I" questions in the Zulip.
from ponyc.
Closing
from ponyc.
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!
from ponyc.
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 Seq[U8]
to the default arg Array[T]
. But to make this compile correctly it would either need to compare Seq[T]
withArray[T]
or alternatively, Seq[U8]
with Array[U8]
.
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.
from ponyc.
Related Issues (20)
- Release 0.57.1 HOT 2
- Generic parameter when copying a trait method into an object that has a generic parameter of the same name HOT 2
- return usage in disposing block's is flawed and we need to revist. HOT 5
- Slow compare to elixir in `ring benchmark` HOT 2
- Clean up MacOS platform version setting HOT 1
- Release 0.58.0 HOT 1
- Release 0.58.1
- Invalid LLVM generated HOT 1
- Segmentation fault when ponyc compiles this code HOT 2
- Compile fails verification "GEP base pointer is not a vector or a vector of pointers" HOT 13
- LLVM mangling error with `powi` HOT 4
- Release 0.58.2
- Constrained Types RFC
- Segfault from bad cap in code
- Release 0.58.3
- Release 0.58.4 HOT 1
- Segfault when accessing a union in a tuple via `Any` HOT 4
- Improve error message for failure of generic subtyping of concrete types HOT 8
- Release 0.58.5 HOT 1
- Release 0.58.6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ponyc.