Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the entitlements migration #3026

Merged
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
Loading