Skip to content

Commit

Permalink
fix: add missing stub indicators for unary-+ operator to BigUInt and …
Browse files Browse the repository at this point in the history
…UInt64
  • Loading branch information
achidlow committed Apr 15, 2024
1 parent cb4f74c commit caa98dc
Show file tree
Hide file tree
Showing 38 changed files with 295 additions and 244 deletions.
52 changes: 26 additions & 26 deletions examples/sizes.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Name O0 size O1 size O1 ⏷ O2 size O2 ⏷
abi_routing/MinimumARC4 54 43 11 43 0
abi_routing/Reference 1234 1076 158 1076 0
amm/ConstantProductAMM 1210 1101 109 1101 0
abi_routing/MinimumARC4 54 43 11 43 0
abi_routing/Reference 1234 1076 158 1076 0
amm/ConstantProductAMM 1210 1101 109 1101 0
application/Reference 175 168 7 168 0
arc-28/EventEmitter 114 77 37 77 0
arc-28/EventEmitter 114 77 37 77 0
arc4_numeric_comparisons/UIntNOrdering 1220 908 312 908 0
arc4_types/Arc4Address 92 62 30 62 0
arc4_types/Arc4Arrays 588 376 212 376 0
arc4_types/Arc4Address 92 62 30 62 0
arc4_types/Arc4Arrays 588 376 212 376 0
arc4_types/Arc4BoolEval 741 14 727 14 0
arc4_types/Arc4BoolType 329 57 272 57 0
arc4_types/Arc4DynamicBytes 298 128 170 128 0
arc4_types/Arc4DynamicStringArray 227 112 115 112 0
arc4_types/Arc4DynamicStringArray 227 112 115 112 0
arc4_types/Arc4MutableParams 362 222 140 220 2
arc4_types/Arc4Mutation 2803 1448 1355 1447 1
arc4_types/Arc4NumericTypes 571 8 563 8 0
Expand All @@ -20,10 +20,10 @@
arc4_types/Arc4StructsType 311 247 64 247 0
arc4_types/Arc4TuplesType 799 146 653 146 0
asset/Reference 268 261 7 261 0
auction/Auction 562 522 40 522 0
auction/Auction 562 522 40 522 0
augmented_assignment/Augmented 157 156 1 156 0
avm_types_in_abi/Test 290 230 60 230 0
biguint_binary_ops/BiguintBinaryOps 180 8 172 8 0
biguint_binary_ops/BiguintBinaryOps 180 8 172 8 0
boolean_binary_ops/BooleanBinaryOps 315 298 17 298 0
bytes_ops/BiguintBinaryOps 143 139 4 139 0
calculator 346 317 29 315 2
Expand All @@ -38,14 +38,14 @@
edverify/Verify 43 37 6 37 0
enumeration/Enumeration 551 501 50 501 0
everything 467 448 19 448 0
global_state/AppState 416 412 4 412 0
global_state/AppState 416 412 4 412 0
hello_world/HelloWorld 23 22 1 22 0
hello_world_arc4/HelloWorld 102 88 14 88 0
hello_world_arc4/HelloWorld 102 88 14 88 0
inheritance/Child 88 88 0 88 0
inheritance/GrandParent 51 51 0 51 0
inheritance/Parent 89 89 0 89 0
inner_transactions 1847 1173 674 1173 0
inner_transactions/Greeter 322 302 20 302 0
inner_transactions/Greeter 322 302 20 302 0
inner_transactions/itxn_loop 203 184 19 184 0
intrinsics/ImmediateVariants 164 162 2 162 0
koopman 16 9 7 9 0
Expand All @@ -57,9 +57,9 @@
logic_signature/pre_approved_sale 136 136 0 136 0
match 490 455 35 455 0
merkle/MerkleTree 214 205 9 205 0
module_consts 52 50 2 50 0
nested_loops/Nested 243 201 42 201 0
regression_118 132 100 32 100 0
module_consts 52 50 2 50 0
nested_loops/Nested 243 201 42 201 0
regression_118 132 100 32 100 0
reversed_iteration 765 547 218 547 0
scratch_slots 70 67 3 67 0
scratch_slots/2 70 67 3 67 0
Expand All @@ -69,23 +69,23 @@
ssa 286 230 56 230 0
ssa2 95 87 8 87 0
state_proxies/StateProxy 87 83 4 83 0
state_totals 38 27 11 27 0
stress_tests/BruteForceRotationSearch 238 175 63 175 0
state_totals 38 27 11 27 0
stress_tests/BruteForceRotationSearch 238 175 63 175 0
string_ops 157 152 5 152 0
stubs/BigUInt 189 112 77 112 0
stubs/BigUInt 194 112 82 112 0
stubs/Bytes 1769 253 1516 253 0
stubs/String 777 141 636 141 0
stubs/Uint64 386 8 378 8 0
template_variables/TemplateVariables 165 155 10 155 0
stubs/Uint64 394 8 386 8 0
template_variables/TemplateVariables 165 155 10 155 0
tictactoe/TicTacToe 894 692 202 680 12
too_many_permutations 108 106 2 106 0
transaction/Transaction 995 936 59 936 0
tuple_support/TupleSupport 442 292 150 292 0
typed_abi_call/Greeter 1282 1168 114 1168 0
typed_abi_call/Logger 545 463 82 463 0
typed_abi_call/Greeter 1282 1168 114 1168 0
typed_abi_call/Logger 545 463 82 463 0
unary/Unary 134 96 38 96 0
unassigned_expression/Unassigned 132 115 17 115 0
undefined_phi_args/Baddie 350 284 66 284 0
unassigned_expression/Unassigned 132 115 17 115 0
undefined_phi_args/Baddie 350 284 66 284 0
unssa/UnSSA 446 369 77 369 0
voting/VotingRoundApp 1592 1490 102 1490 0
with_reentrancy/WithReentrancy 264 242 22 242 0
voting/VotingRoundApp 1592 1490 102 1490 0
with_reentrancy/WithReentrancy 264 242 22 242 0
4 changes: 4 additions & 0 deletions stubs/algopy-stubs/_primitives.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ class UInt64:
"""A UInt64 can be bitwise inverted e.g. `~UInt64(4)`"""
def __index__(self) -> int:
"""A UInt64 can be used in indexing/slice expressions"""
def __pos__(self) -> UInt64:
"""Supports unary + operator. Redundant given the type is unsigned"""

class Bytes(Reversible[Bytes]):
"""A byte sequence, with a maximum length of 4096 bytes, one of the primary data types on the AVM"""
Expand Down Expand Up @@ -389,3 +391,5 @@ class BigUInt(BytesBacked):
"""A BigUInt can bitwise or with another BigUInt, UInt64 or int e.g. `4 | BigUInt(2)`"""
def __ior__(self, other: BigUInt | UInt64 | int) -> BigUInt:
"""A BigUInt can bitwise or with another BigUInt, UInt64 or int e.g. `a |= BigUInt(2)`"""
def __pos__(self) -> BigUInt:
"""Supports unary + operator. Redundant given the type is unsigned"""
6 changes: 4 additions & 2 deletions test_cases/stubs/biguint.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

class BigUIntContract(Contract):
def approval_program(self) -> bool:
compare_biguints(BigUInt(1), BigUInt(2))
compare_biguint_vs_uint64(BigUInt(1), UInt64(2))
one = BigUInt(1)
compare_biguints(one, BigUInt(2))
compare_biguint_vs_uint64(one, UInt64(2))
compare_uint64_vs_biguint(UInt64(1), BigUInt(2))
assert op.bsqrt(BigUInt(9)) == op.bsqrt(10)
assert one == +one
return True

def clear_state_program(self) -> bool:
Expand Down
Loading

0 comments on commit caa98dc

Please sign in to comment.