diff --git a/migrations/entitlements/migration.go b/migrations/entitlements/migration.go index 72390a2a96..575812a510 100644 --- a/migrations/entitlements/migration.go +++ b/migrations/entitlements/migration.go @@ -241,11 +241,9 @@ func ConvertValueToEntitlements( return nil, nil } - return v.NewWithType( - inter, - interpreter.EmptyLocationRange, + v.SetType( entitledElementType.(interpreter.ArrayStaticType), - ), nil + ) case *interpreter.DictionaryValue: elementType := v.Type @@ -259,11 +257,9 @@ func ConvertValueToEntitlements( return nil, nil } - return v.NewWithType( - inter, - interpreter.EmptyLocationRange, + v.SetType( entitledElementType.(*interpreter.DictionaryStaticType), - ), nil + ) case *interpreter.IDCapabilityValue: borrowType := v.BorrowType diff --git a/migrations/migration_test.go b/migrations/migration_test.go index 2efa95efbc..73ae881844 100644 --- a/migrations/migration_test.go +++ b/migrations/migration_test.go @@ -1151,7 +1151,7 @@ func (testContainerMigration) Migrate( interpreter.PrimitiveStaticTypeAnyStruct, ) - return value.NewWithType(inter, emptyLocationRange, newType), nil + value.SetType(newType) case *interpreter.ArrayValue: @@ -1159,7 +1159,7 @@ func (testContainerMigration) Migrate( interpreter.PrimitiveStaticTypeAnyStruct, ) - return value.NewWithType(inter, emptyLocationRange, newType), nil + value.SetType(newType) case *interpreter.CompositeValue: if value.QualifiedIdentifier == "Inner" { diff --git a/migrations/statictypes/statictype_migration.go b/migrations/statictypes/statictype_migration.go index 3bc3e7bd8f..66ee3f1a32 100644 --- a/migrations/statictypes/statictype_migration.go +++ b/migrations/statictypes/statictype_migration.go @@ -136,11 +136,9 @@ func (m *StaticTypeMigration) Migrate( return } - return value.NewWithType( - inter, - interpreter.EmptyLocationRange, + value.SetType( convertedElementType.(interpreter.ArrayStaticType), - ), nil + ) case *interpreter.DictionaryValue: convertedElementType := m.maybeConvertStaticType(value.Type, nil) @@ -148,11 +146,9 @@ func (m *StaticTypeMigration) Migrate( return } - return value.NewWithType( - inter, - interpreter.EmptyLocationRange, + value.SetType( convertedElementType.(*interpreter.DictionaryStaticType), - ), nil + ) } return