Conversation
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit a0dd6cf Collapsed results for better readability
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
cc @turbolent do we need to implement importing/exporting if the only places we are currently using the expanded type bounds is in builtin types? |
| // TODO: implement this for generalized bounds | ||
| return cadence.NewTypeParameter(name, typeBound), nil |
There was a problem hiding this comment.
This should be sufficient to support decoding any function types that aren't one of the small set of builtins that this PR changes.
| // TODO: perhaps generalize this? | ||
| if typeParameter.TypeBound == nil { | ||
| return e.encodeNullableTypeValue(nil, visited) | ||
| } | ||
|
|
||
| subTypeBound, isSubtypeBound := typeParameter.TypeBound.(cadence.SubtypeTypeBound) | ||
| if !isSubtypeBound { | ||
| panic(cadenceErrors.NewUnexpectedError("cannot store non-subtype bounded function type parameter %s", typeParameter.TypeBound)) | ||
| } | ||
|
|
||
| // element 1: type as type-bound. | ||
| return e.encodeNullableTypeValue(typeParameter.TypeBound, visited) | ||
| return e.encodeNullableTypeValue(subTypeBound.Type, visited) |
There was a problem hiding this comment.
This should be sufficient to support encoding any function types that aren't one of the small set of builtins that this PR changes.
| var convertedParameterTypeBound cadence.TypeBound | ||
| if typeBound != nil { | ||
| convertedParameterTypeBound = ExportMeteredType(gauge, typeBound, results) | ||
| convertedParameterTypeBound = exportTypeBound(gauge, typeBound, results) |
There was a problem hiding this comment.
Perhaps I just couldn't find it, but is there an equivalent importFunctionType or similar that also needs to change here?
Work towards https://github.com/dapperlabs/cadence-internal/issues/188
Description
See https://github.com/dapperlabs/cadence-internal/issues/188#issuecomment-1906752366
Currently, type bounds for type parameters may only be subtype relationships.
Generalize the type bounds feature to support:
T <: U)T <: U && T != U)U <: T)U <: T && T != U)X && Y)X || Y)This also replaces some existing cases that were using
TypeArgumentsCheckto use this new generalized type bound infrastructure. In particular:Capabilities.get,InclusiveRangeandrevertibleRandom.masterbranchFiles changedin the Github PR explorer