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

Support recursive supertype inferring for containers #1319

Merged
merged 8 commits into from
Jan 5, 2022

Conversation

SupunS
Copy link
Member

@SupunS SupunS commented Dec 18, 2021

Closes #1225

Description

This PR add $subject for arrays and dictionaries.


  • 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

@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2021

Codecov Report

Merging #1319 (c650dbc) into master (51cac40) will decrease coverage by 1.84%.
The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1319      +/-   ##
==========================================
- Coverage   77.43%   75.58%   -1.85%     
==========================================
  Files         279      279              
  Lines       36174    37869    +1695     
==========================================
+ Hits        28010    28622     +612     
- Misses       7071     7964     +893     
- Partials     1093     1283     +190     
Flag Coverage Δ
unittests 75.58% <81.81%> (-1.85%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
runtime/sema/type_tags.go 91.74% <81.81%> (-3.77%) ⬇️
runtime/sema/ranges.go 80.95% <0.00%> (-19.05%) ⬇️
runtime/interpreter/value.go 68.95% <0.00%> (-11.32%) ⬇️
runtime/sema/member_accesses.go 44.00% <0.00%> (-11.00%) ⬇️
runtime/sema/occurrences.go 72.41% <0.00%> (-9.59%) ⬇️
runtime/sema/function_invocations.go 65.00% <0.00%> (-7.23%) ⬇️
runtime/interpreter/errors.go 22.13% <0.00%> (-2.03%) ⬇️
runtime/sema/variable_activations.go 93.38% <0.00%> (-1.57%) ⬇️
runtime/sema/checker.go 89.08% <0.00%> (-0.57%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 51cac40...c650dbc. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Dec 18, 2021

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 834f5f1
The command for i in {1..N}; do go test ./... -run=XXX -bench=. -shuffle=on; done was used.
Bench tests were run a total of 7 times on each branch.

Results

old.txtnew.txt
time/opdelta
QualifiedIdentifierCreation/One_level-22.85ns ± 6%3.00ns ± 4%+5.16%(p=0.026 n=7+7)
RuntimeResourceDictionaryValues-214.8ms ± 7%15.4ms ± 6%~(p=0.165 n=7+7)
RuntimeFungibleTokenTransfer-21.16ms ±25%1.23ms ±23%~(p=0.165 n=7+7)
ParseInfix-222.7µs ± 8%23.4µs ± 5%~(p=0.165 n=7+7)
ParseArray-221.3ms ± 8%21.9ms ± 5%~(p=0.318 n=7+7)
ParseDeploy/byte_array-232.0ms ± 6%33.8ms ± 3%~(p=0.073 n=7+6)
ParseDeploy/decode_hex-21.27ms ± 9%1.33ms ± 1%~(p=0.097 n=7+7)
ParseFungibleToken-2429µs ± 7%444µs ± 3%~(p=0.209 n=7+7)
QualifiedIdentifierCreation/Three_levels-2149ns ± 6%152ns ± 2%~(p=0.731 n=7+6)
ContractInterfaceFungibleToken-243.0µs ±13%44.6µs ± 6%~(p=0.165 n=7+7)
CheckContractInterfaceFungibleTokenConformance-2140µs ± 7%145µs ± 4%~(p=0.710 n=7+7)
NewInterpreter/new_interpreter-21.06µs ± 6%1.11µs ± 2%~(p=0.710 n=7+7)
NewInterpreter/new_sub-interpreter-22.14µs ± 7%2.21µs ± 3%~(p=0.421 n=7+6)
InterpretRecursionFib-22.43ms ± 5%2.52ms ± 3%~(p=0.073 n=7+7)
 
alloc/opdelta
RuntimeResourceDictionaryValues-24.04MB ± 0%4.04MB ± 0%~(p=0.456 n=7+7)
RuntimeFungibleTokenTransfer-2238kB ± 0%238kB ± 0%~(p=0.776 n=7+7)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
ContractInterfaceFungibleToken-226.5kB ± 0%26.5kB ± 0%~(all equal)
CheckContractInterfaceFungibleTokenConformance-265.7kB ± 0%65.7kB ± 0%~(all equal)
NewInterpreter/new_interpreter-2720B ± 0%720B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-21.18kB ± 0%1.18kB ± 0%~(all equal)
InterpretRecursionFib-21.24MB ± 0%1.24MB ± 0%~(all equal)
 
allocs/opdelta
RuntimeResourceDictionaryValues-2102k ± 0%102k ± 0%~(p=0.464 n=7+7)
RuntimeFungibleTokenTransfer-24.54k ± 0%4.54k ± 0%~(p=1.000 n=7+7)
QualifiedIdentifierCreation/One_level-20.00 0.00 ~(all equal)
QualifiedIdentifierCreation/Three_levels-22.00 ± 0%2.00 ± 0%~(all equal)
ContractInterfaceFungibleToken-2457 ± 0%457 ± 0%~(all equal)
CheckContractInterfaceFungibleTokenConformance-21.07k ± 0%1.07k ± 0%~(all equal)
NewInterpreter/new_interpreter-211.0 ± 0%11.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-236.0 ± 0%36.0 ± 0%~(all equal)
InterpretRecursionFib-225.0k ± 0%25.0k ± 0%~(all equal)
 

@SupunS SupunS force-pushed the supun/type-inference branch from a280653 to 051bf15 Compare December 18, 2021 04:49
Copy link
Contributor

@dsainati1 dsainati1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exciting! Thanks for following up on this!

@SupunS SupunS force-pushed the supun/type-inference branch from f41dc08 to c650dbc Compare December 21, 2021 20:35
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! 👏

return InvalidType
}

if !IsValidDictionaryKeyType(keySuperType) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@SupunS SupunS merged commit e0b981c into master Jan 5, 2022
@SupunS SupunS deleted the supun/type-inference branch January 5, 2022 20:20
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.

Support Recursive supertype inferring for containers
4 participants