From 9a8f2f320e30cb2cd038f631005e0af59c4458e1 Mon Sep 17 00:00:00 2001 From: FRLABS#8187 <85702617+FelipeRibeiroLabs@users.noreply.github.com> Date: Fri, 8 Mar 2024 19:34:46 -0300 Subject: [PATCH] Fix intersection types snippet issues --- versioned_docs/version-1.0/language/intersection-types.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/versioned_docs/version-1.0/language/intersection-types.md b/versioned_docs/version-1.0/language/intersection-types.md index 8f0021a..7c12575 100644 --- a/versioned_docs/version-1.0/language/intersection-types.md +++ b/versioned_docs/version-1.0/language/intersection-types.md @@ -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) @@ -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 } @@ -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") -``` \ No newline at end of file +```