diff --git a/migrations/entitlements/migration_test.go b/migrations/entitlements/migration_test.go index edd2481c85..a46ae9fe58 100644 --- a/migrations/entitlements/migration_test.go +++ b/migrations/entitlements/migration_test.go @@ -540,13 +540,45 @@ func TestConvertToEntitledType(t *testing.T) { Output: sema.NewReferenceType( nil, eFAndGAccess, - sema.NewIntersectionType(nil, []*sema.InterfaceType{ - interfaceTypeInheriting, - interfaceTypeWithMap, - }), + sema.NewIntersectionType( + nil, + []*sema.InterfaceType{ + interfaceTypeInheriting, + interfaceTypeWithMap, + }), ), Name: "intersection", }, + { + Input: sema.NewReferenceType( + nil, + sema.UnauthorizedAccess, + sema.NewOptionalType( + nil, + sema.NewIntersectionType( + nil, + []*sema.InterfaceType{ + interfaceTypeInheriting, + interfaceTypeWithMap, + }, + ), + ), + ), + Output: sema.NewReferenceType( + nil, + eFAndGAccess, + sema.NewOptionalType( + nil, + sema.NewIntersectionType( + nil, + []*sema.InterfaceType{ + interfaceTypeInheriting, + interfaceTypeWithMap, + }), + ), + ), + Name: "reference to optional", + }, // no change { Input: sema.NewReferenceType(nil, sema.UnauthorizedAccess, compositeTypeWithCapField), diff --git a/migrations/statictypes/account_type_migration_test.go b/migrations/statictypes/account_type_migration_test.go index eaeb97a0cb..f1d74bdb0f 100644 --- a/migrations/statictypes/account_type_migration_test.go +++ b/migrations/statictypes/account_type_migration_test.go @@ -410,6 +410,26 @@ func TestAccountTypeInTypeValueMigration(t *testing.T) { ), expectedType: nil, }, + + // reference to optionals + "reference_to_optional": { + storedType: interpreter.NewReferenceStaticType( + nil, + interpreter.UnauthorizedAccess, + interpreter.NewOptionalStaticType( + nil, + interpreter.PrimitiveStaticTypeAccountKey, //nolint:staticcheck + ), + ), + expectedType: interpreter.NewReferenceStaticType( + nil, + interpreter.UnauthorizedAccess, + interpreter.NewOptionalStaticType( + nil, + interpreter.AccountKeyStaticType, + ), + ), + }, } test := func(name string, testCase testCase) { diff --git a/migrations/statictypes/composite_type_migration_test.go b/migrations/statictypes/composite_type_migration_test.go index 87f15b2dbc..da57c92c1e 100644 --- a/migrations/statictypes/composite_type_migration_test.go +++ b/migrations/statictypes/composite_type_migration_test.go @@ -71,7 +71,7 @@ func TestCompositeAndInterfaceTypeMigration(t *testing.T) { testCases := map[string]testCase{ // base cases - "compositeToInterface": { + "composite_to_interface": { storedType: newCompositeType(), expectedType: interpreter.NewIntersectionStaticType( nil, @@ -80,7 +80,7 @@ func TestCompositeAndInterfaceTypeMigration(t *testing.T) { }, ), }, - "interfaceToComposite": { + "interface_to_composite": { storedType: newInterfaceType(), expectedType: newCompositeType(), }, @@ -99,6 +99,19 @@ func TestCompositeAndInterfaceTypeMigration(t *testing.T) { storedType: interpreter.NewDictionaryStaticType(nil, newInterfaceType(), newInterfaceType()), expectedType: interpreter.NewDictionaryStaticType(nil, newCompositeType(), newCompositeType()), }, + // reference to optional + "reference_to_optional": { + storedType: interpreter.NewReferenceStaticType( + nil, + interpreter.UnauthorizedAccess, + interpreter.NewOptionalStaticType(nil, newInterfaceType()), + ), + expectedType: interpreter.NewReferenceStaticType( + nil, + interpreter.UnauthorizedAccess, + interpreter.NewOptionalStaticType(nil, newCompositeType()), + ), + }, } // Store values diff --git a/tools/update/config.yaml b/tools/update/config.yaml index 9f528df200..b49dabcdfb 100644 --- a/tools/update/config.yaml +++ b/tools/update/config.yaml @@ -76,7 +76,7 @@ repos: - onflow/flow-emulator - onflow/cadence-tools/lint - onflow/cadence-tools/test - - onflow/flowkit + - onflow/flowkit/v2 - repo: onflow/flixkit-go needsRelease: true @@ -103,4 +103,4 @@ repos: - onflow/cadence-tools/lint - onflow/cadence-tools/languageserver - onflow/flixkit-go - - onflow/flowkit + - onflow/flowkit/v2