Skip to content

Commit

Permalink
Merge pull request #64 from FelipeRibeiroLabs/patch-1
Browse files Browse the repository at this point in the history
Fix intersection types snippet issues
  • Loading branch information
turbolent authored Mar 8, 2024
2 parents dd455bf + 9a8f2f3 commit e120667
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions versioned_docs/version-1.0/language/intersection-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ any concrete value of that type must implement both of them:
access(all)
struct interface HasMetadata {
access(all)
let metadata: AnyStruct
var metadata: AnyStruct
}
access(all)
Expand All @@ -93,8 +93,10 @@ struct C: HasID, HasMetadata {
init(id: String) {
self.id = id
self.metadata = []
}
access(all)
fun setMetadata(_ data: AnyStruct) {
self.metadata = data
}
Expand All @@ -103,6 +105,6 @@ struct C: HasID, HasMetadata {
// valid, because `C` implements both `HasID` and `HasMetadata`.
let hasID3: {HasID, HasMetadata} = C(id: "3")
// valid, because `A` implements only `HasID`.
// Invalid, because `A` implements only `HasID`.
let hasID4: {HasID, HasMetadata} = A(id: "4")
```
```

0 comments on commit e120667

Please sign in to comment.