Skip to content

Record occurrences of nested types and imported members#4487

Merged
turbolent merged 5 commits into
masterfrom
bastian/record-nested-type-occurrences
May 19, 2026
Merged

Record occurrences of nested types and imported members#4487
turbolent merged 5 commits into
masterfrom
bastian/record-nested-type-occurrences

Conversation

@turbolent

@turbolent turbolent commented May 14, 2026

Copy link
Copy Markdown
Member

Description

Needed for onflow/cadence-tools#636

Also record the occurrences of

  • Nested types: We already record the occurrence of C in C.S, also record the occurrence of S.
  • Imported members

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@turbolent turbolent self-assigned this May 14, 2026
@turbolent turbolent requested a review from SupunS as a code owner May 14, 2026 21:03
@github-actions

github-actions Bot commented May 14, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

github-actions Bot commented May 14, 2026

Copy link
Copy Markdown

Benchstat comparison

  • Base branch: onflow:master
  • Base commit: bdbec2d
Results

old.txtnew.txt
time/opdelta
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ByteArrayTransfer-41.30µs ± 0%1.22µs ± 0%~(p=1.000 n=1+1)
ByteArrayValueToByteSlice-486.3ns ± 0%88.8ns ± 0%~(p=1.000 n=1+1)
ByteSliceToByteArrayValue-4929ns ± 0%1131ns ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ContractFunctionInvocation-4355µs ± 0%358µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
EMVAddressTransfer-43.58µs ± 0%3.54µs ± 0%~(p=1.000 n=1+1)
Emit-44.49ms ± 0%4.41ms ± 0%~(p=1.000 n=1+1)
EnumTransfer-41.44µs ± 0%1.35µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ExportType/composite_type-4245ns ± 0%241ns ± 0%~(p=1.000 n=1+1)
ExportType/simple_type-476.7ns ± 0%76.9ns ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/sema goos:linux goarch:amd64
FlowTokenContract-4568µs ± 0%565µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ImperativeFib-419.9µs ± 0%20.4µs ± 0%~(p=1.000 n=1+1)
InterpretRecursionFib-42.12ms ± 0%2.27ms ± 0%~(p=1.000 n=1+1)
NewInterpreter/new_interpreter-4854ns ± 0%848ns ± 0%~(p=1.000 n=1+1)
NewInterpreter/new_sub-interpreter-4327ns ± 0%320ns ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/sema goos:linux goarch:amd64
QualifiedIdentifierCreation/One_level-42.46ns ± 0%2.11ns ± 0%~(p=1.000 n=1+1)
QualifiedIdentifierCreation/Three_levels-479.3ns ± 0%83.8ns ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
RuntimeFungibleTokenTransferInterpreter-4581µs ± 0%612µs ± 0%~(p=1.000 n=1+1)
RuntimeFungibleTokenTransferVM-4705µs ± 0%658µs ± 0%~(p=1.000 n=1+1)
RuntimeResourceDictionaryValues-42.66ms ± 0%2.69ms ± 0%~(p=1.000 n=1+1)
RuntimeResourceTracking-49.24ms ± 0%9.33ms ± 0%~(p=1.000 n=1+1)
RuntimeScriptNoop-414.6µs ± 0%14.5µs ± 0%~(p=1.000 n=1+1)
RuntimeVMInvokeContractImperativeFib-436.7µs ± 0%36.4µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/sema goos:linux goarch:amd64
SuperTypeInference/arrays-4205ns ± 0%206ns ± 0%~(p=1.000 n=1+1)
SuperTypeInference/composites-4119ns ± 0%87ns ± 0%~(p=1.000 n=1+1)
SuperTypeInference/integers-4330ns ± 0%334ns ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ValueIsSubtypeOfSemaType-458.9ns ± 0%60.2ns ± 0%~(p=1.000 n=1+1)
 
alloc/opdelta
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ByteArrayTransfer-41.06kB ± 0%1.08kB ± 0%~(p=1.000 n=1+1)
ByteArrayValueToByteSlice-432.0B ± 0%32.0B ± 0%~(all equal)
ByteSliceToByteArrayValue-4854B ± 0%868B ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ContractFunctionInvocation-4144kB ± 0%144kB ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
EMVAddressTransfer-42.46kB ± 0%2.44kB ± 0%~(p=1.000 n=1+1)
Emit-41.49MB ± 0%1.49MB ± 0%~(p=1.000 n=1+1)
EnumTransfer-4827B ± 0%834B ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ExportType/composite_type-4120B ± 0%120B ± 0%~(all equal)
ExportType/simple_type-40.00B 0.00B ~(all equal)
pkg:github.com/onflow/cadence/sema goos:linux goarch:amd64
FlowTokenContract-4226kB ± 0%226kB ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ImperativeFib-48.30kB ± 0%8.30kB ± 0%~(all equal)
InterpretRecursionFib-41.19MB ± 0%1.19MB ± 0%~(p=1.000 n=1+1)
NewInterpreter/new_interpreter-4976B ± 0%976B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-4232B ± 0%232B ± 0%~(all equal)
pkg:github.com/onflow/cadence/sema goos:linux goarch:amd64
QualifiedIdentifierCreation/One_level-40.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-464.0B ± 0%64.0B ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
RuntimeFungibleTokenTransferInterpreter-4165kB ± 0%165kB ± 0%~(p=1.000 n=1+1)
RuntimeFungibleTokenTransferVM-4188kB ± 0%188kB ± 0%~(p=1.000 n=1+1)
RuntimeResourceDictionaryValues-41.77MB ± 0%1.77MB ± 0%~(p=1.000 n=1+1)
RuntimeResourceTracking-46.97MB ± 0%6.98MB ± 0%~(p=1.000 n=1+1)
RuntimeScriptNoop-48.09kB ± 0%8.09kB ± 0%~(p=1.000 n=1+1)
RuntimeVMInvokeContractImperativeFib-413.4kB ± 0%13.4kB ± 0%~(all equal)
pkg:github.com/onflow/cadence/sema goos:linux goarch:amd64
SuperTypeInference/arrays-472.0B ± 0%72.0B ± 0%~(all equal)
SuperTypeInference/composites-40.00B 0.00B ~(all equal)
SuperTypeInference/integers-40.00B 0.00B ~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ValueIsSubtypeOfSemaType-432.0B ± 0%32.0B ± 0%~(all equal)
 
allocs/opdelta
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ByteArrayTransfer-47.00 ± 0%7.00 ± 0%~(all equal)
ByteArrayValueToByteSlice-41.00 ± 0%1.00 ± 0%~(all equal)
ByteSliceToByteArrayValue-45.00 ± 0%5.00 ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ContractFunctionInvocation-42.25k ± 0%2.25k ± 0%~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
EMVAddressTransfer-429.0 ± 0%29.0 ± 0%~(all equal)
Emit-440.0k ± 0%40.0k ± 0%~(all equal)
EnumTransfer-413.0 ± 0%13.0 ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ExportType/composite_type-43.00 ± 0%3.00 ± 0%~(all equal)
ExportType/simple_type-40.00 0.00 ~(all equal)
pkg:github.com/onflow/cadence/sema goos:linux goarch:amd64
FlowTokenContract-43.58k ± 0%3.58k ± 0%~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ImperativeFib-4176 ± 0%176 ± 0%~(all equal)
InterpretRecursionFib-417.7k ± 0%17.7k ± 0%~(all equal)
NewInterpreter/new_interpreter-415.0 ± 0%15.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-44.00 ± 0%4.00 ± 0%~(all equal)
pkg:github.com/onflow/cadence/sema goos:linux goarch:amd64
QualifiedIdentifierCreation/One_level-40.00 0.00 ~(all equal)
QualifiedIdentifierCreation/Three_levels-42.00 ± 0%2.00 ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
RuntimeFungibleTokenTransferInterpreter-43.08k ± 0%3.08k ± 0%~(all equal)
RuntimeFungibleTokenTransferVM-43.61k ± 0%3.61k ± 0%~(all equal)
RuntimeResourceDictionaryValues-436.7k ± 0%36.7k ± 0%~(p=1.000 n=1+1)
RuntimeResourceTracking-4129k ± 0%129k ± 0%~(p=1.000 n=1+1)
RuntimeScriptNoop-4114 ± 0%114 ± 0%~(all equal)
RuntimeVMInvokeContractImperativeFib-4426 ± 0%426 ± 0%~(all equal)
pkg:github.com/onflow/cadence/sema goos:linux goarch:amd64
SuperTypeInference/arrays-43.00 ± 0%3.00 ± 0%~(all equal)
SuperTypeInference/composites-40.00 0.00 ~(all equal)
SuperTypeInference/integers-40.00 0.00 ~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ValueIsSubtypeOfSemaType-41.00 ± 0%1.00 ± 0%~(all equal)
 

Comment thread sema/checker.go
@turbolent turbolent changed the title Record occurrences of nested types Record occurrences of nested types and imported members May 15, 2026
@turbolent turbolent requested a review from SupunS May 15, 2026 19:13
@turbolent turbolent merged commit c334d2d into master May 19, 2026
17 checks passed
@turbolent turbolent deleted the bastian/record-nested-type-occurrences branch May 19, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants