Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/onflow/cadence into supun…
Browse files Browse the repository at this point in the history
…/improve-migrations
  • Loading branch information
SupunS committed Jan 17, 2024
2 parents 8d09014 + 6a1b9e4 commit ea9086c
Show file tree
Hide file tree
Showing 20 changed files with 873 additions and 237 deletions.
13 changes: 1 addition & 12 deletions encoding/ccf/simpletype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,12 @@ func TestTypeConversion(t *testing.T) {
}

for ty := interpreter.PrimitiveStaticType(1); ty < interpreter.PrimitiveStaticType_Count; ty++ {
if !ty.IsDefined() {
if !ty.IsDefined() || ty.IsDeprecated() { //nolint:staticcheck
continue
}

semaType := ty.SemaType()

// Some primitive static types are deprecated,
// and only exist for migration purposes,
// so do not have an equivalent sema type
if semaType == nil {
continue
}

if ty.IsDeprecated() { //nolint:staticcheck
continue
}

if _, ok := semaType.(*sema.CapabilityType); ok {
continue
}
Expand Down
9 changes: 1 addition & 8 deletions encoding/json/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ var simpleTypes = func() map[string]cadence.Type {
typeMap["Bytes"] = cadence.TheBytesType

for ty := interpreter.PrimitiveStaticType(1); ty < interpreter.PrimitiveStaticType_Count; ty++ {
if !ty.IsDefined() {
if !ty.IsDefined() || ty.IsDeprecated() { //nolint:staticcheck
continue
}

Expand All @@ -1215,13 +1215,6 @@ var simpleTypes = func() map[string]cadence.Type {

semaType := ty.SemaType()

// Some primitive static types are deprecated,
// and only exist for migration purposes,
// so do not have an equivalent sema type
if semaType == nil {
continue
}

typeMap[string(semaType.ID())] = cadenceType
}

Expand Down
9 changes: 1 addition & 8 deletions encoding/json/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3667,19 +3667,12 @@ func TestSimpleTypes(t *testing.T) {
}

for ty := interpreter.PrimitiveStaticType(1); ty < interpreter.PrimitiveStaticType_Count; ty++ {
if !ty.IsDefined() {
if !ty.IsDefined() || ty.IsDeprecated() { //nolint:staticcheck
continue
}

semaType := ty.SemaType()

// Some primitive static types are deprecated,
// and only exist for migration purposes,
// so do not have an equivalent sema type
if semaType == nil {
continue
}

cadenceType := cadence.PrimitiveType(ty)
if !canEncodeAsSimpleType(cadenceType) {
continue
Expand Down
Loading

0 comments on commit ea9086c

Please sign in to comment.