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

Pretty print types #1281

Merged
merged 11 commits into from
Dec 7, 2021
Merged

Pretty print types #1281

merged 11 commits into from
Dec 7, 2021

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Nov 29, 2021

Work towards #209

Description

Implement pretty-printing functions for all type AST nodes:

  • TypeAnnotation
  • NominalType
  • OptionalType
  • VariableSizedType
  • ConstantSizedType
  • DictionaryType
  • FunctionType
  • ReferenceType
  • RestrictedType
  • InstantiationType

Also, include type annotations in expressions.


  • 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 Nov 29, 2021
@turbolent turbolent changed the title Bastian/prettier 3 Pretty print types Nov 29, 2021
Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

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

🎉

Base automatically changed from bastian/prettier-2 to master December 7, 2021 10:17
@github-actions
Copy link

github-actions bot commented Dec 7, 2021

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 64592b4
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
RuntimeFungibleTokenTransfer-21.31ms ± 3%1.11ms ±17%~(p=0.051 n=6+7)
RuntimeResourceDictionaryValues-214.1ms ± 3%14.0ms ± 2%~(p=0.383 n=7+7)
ParseInfix-223.3µs ± 2%23.2µs ± 2%~(p=0.073 n=7+7)
ParseDeploy/byte_array-232.9ms ± 1%32.9ms ± 3%~(p=0.234 n=6+7)
ParseDeploy/decode_hex-21.17ms ± 3%1.16ms ± 0%~(p=0.534 n=7+6)
QualifiedIdentifierCreation/One_level-22.81ns ± 0%2.81ns ± 0%~(p=0.115 n=7+7)
QualifiedIdentifierCreation/Three_levels-2122ns ± 1%122ns ± 1%~(p=0.563 n=6+6)
ContractInterfaceFungibleToken-239.9µs ± 2%39.8µs ± 1%~(p=0.290 n=6+6)
CheckContractInterfaceFungibleTokenConformance-2129µs ± 1%131µs ± 5%~(p=1.000 n=7+7)
NewInterpreter/new_interpreter-2964ns ± 0%962ns ± 0%~(p=0.247 n=5+6)
NewInterpreter/new_sub-interpreter-21.89µs ± 1%1.88µs ± 0%~(p=0.138 n=7+6)
InterpretRecursionFib-22.48ms ± 1%2.47ms ± 2%~(p=0.138 n=6+7)
ParseArray-221.8ms ± 1%21.6ms ± 1%−0.73%(p=0.017 n=7+7)
ParseFungibleToken-2433µs ± 1%429µs ± 1%−0.92%(p=0.026 n=7+7)
 
alloc/opdelta
RuntimeFungibleTokenTransfer-2238kB ± 0%238kB ± 0%~(p=0.220 n=7+6)
RuntimeResourceDictionaryValues-24.34MB ± 0%4.34MB ± 0%~(p=1.000 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%~(p=0.592 n=7+7)
NewInterpreter/new_interpreter-2720B ± 0%720B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-21.11kB ± 0%1.11kB ± 0%~(all equal)
InterpretRecursionFib-21.24MB ± 0%1.24MB ± 0%~(p=0.147 n=7+7)
 
allocs/opdelta
RuntimeFungibleTokenTransfer-24.53k ± 0%4.53k ± 0%~(p=0.066 n=7+7)
RuntimeResourceDictionaryValues-2108k ± 0%108k ± 0%~(p=0.849 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-232.0 ± 0%32.0 ± 0%~(all equal)
InterpretRecursionFib-225.0k ± 0%25.0k ± 0%~(all equal)
 

@turbolent turbolent merged commit f72f067 into master Dec 7, 2021
@turbolent turbolent deleted the bastian/prettier-3 branch December 7, 2021 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants