Skip to content

Commit

Permalink
Make snippets interactive with annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
shaedrich authored Jun 5, 2024
1 parent caae6e2 commit 5f15b59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions code-samples/as-operator-array-literal.pony
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ actor Main

new create(env: Env) =>
foo([as U32: 1; 2; 3])
// the compiler would complain about this:
// foo([1; 2; 3])
// Try changing it to
// foo([1; 2; 3])
// the compiler would complain about this:
2 changes: 1 addition & 1 deletion docs/expressions/as.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The `as` operator can also be used to tell the compiler what type to use for the

For example, in the case of the following program, the method `foo` can take either an `Array[U32] ref` or an `Array[U64] ref` as an argument. If a literal array is passed as an argument to the method and no type is specified then the compiler cannot deduce the correct one because there are two equally valid ones.

```pony
```{ .pony .annotate }
--8<-- "as-operator-array-literal.pony"
```

Expand Down

0 comments on commit 5f15b59

Please sign in to comment.