1import smartpy as sp
2import sys
3
4
5# fix for issue #142 - name resolution of `A` and `f()` should work for derived classes
6
7
8@sp.module
9def main():
10 class A(sp.Contract):
11 pass
12
13 def f():
14 return 42
15
16 class Creator(sp.Contract):
17 @sp.entrypoint
18 def create1(self):
19 _ = f()
20 _ = sp.create_contract(A, None, sp.mutez(123), ())
21
22
23@sp.module
24def main2():
25 class CreatorSubclass(main.Creator):
26 pass
27
28
29@sp.add_test()
30def test():
31 try:
32 scenario = sp.test_scenario("Create", [main, main2])
33 except Exception as e:
34 print("CAUGHT", e, file=sys.stderr)
35 assert False