We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b775044 commit edbe3c2Copy full SHA for edbe3c2
integration_tests/test_generics_01.py
@@ -0,0 +1,30 @@
1
+from ltypes import overload
2
+
3
+@overload
4
+def foo(a: int, b: int) -> int:
5
+ return a*b
6
7
8
+def foo(a: int) -> int:
9
+ return a**2
10
11
12
+def foo(a: str) -> str:
13
+ return "lpython-" + a
14
15
16
+def test(a: int) -> int:
17
+ return a + 10
18
19
20
+def test(a: bool) -> int:
21
+ if a:
22
+ return 10
23
+ return -10
24
25
26
+assert foo(2) == 4
27
+assert foo(2, 10) == 20
28
+assert foo("hello") == "lpython-hello"
29
+assert test(10) == 20
30
+assert test(False) == -test(True) and test(True) == 10
0 commit comments