-
-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
922350a
commit 06a9542
Showing
2 changed files
with
25 additions
and
24 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## Allow constructor expressions to be auto-recovered in assignments or arguments | ||
|
||
Previously for the following code: | ||
|
||
```pony | ||
actor Main | ||
new create(env: Env) => | ||
Bar.take_foo(Foo(88)) | ||
let bar: Foo iso = Foo(88) | ||
class Foo | ||
new create(v: U8) => | ||
None | ||
primitive Bar | ||
fun take_foo(foo: Foo iso) => | ||
None | ||
``` | ||
|
||
You'd get compilation errors "argument not assignable to parameter" and "right side must be a subtype of left side" for the two lines in `Main.create()`. | ||
|
||
We've added checks to see if the constructor expressions can be implicitly auto-recovered, and if they can, no compilation error is generated. | ||
|
||
This only applies to cases where the type of the parameter (or the `let` binding) is a simple type, i.e. not a union, intersection or tuple type. | ||
|