-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #695 (Pending hugr release including commit b05a419)
- Loading branch information
Showing
9 changed files
with
80 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Error: Unsupported constant (at $FILE:7:8) | ||
Error: Unsupported constant (at $FILE:6:9) | ||
| | ||
5 | @compile_guppy | ||
6 | def foo() -> None: | ||
7 | x = "foo" | ||
| ^^^^^ Type `str` is not supported | ||
4 | @compile_guppy | ||
5 | def foo() -> None: | ||
6 | x = -2j | ||
| ^^ Type `complex` is not supported | ||
|
||
Guppy compilation failed due to 1 previous error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
from guppylang.std.builtins import array | ||
from tests.util import compile_guppy | ||
|
||
|
||
@compile_guppy | ||
def foo() -> None: | ||
x = "foo" | ||
x = -2j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from guppylang.decorator import guppy | ||
from guppylang.module import GuppyModule | ||
from tests.util import compile_guppy | ||
|
||
import pytest | ||
|
||
def test_basic_type(validate): | ||
@compile_guppy | ||
def foo(x: str) -> str: | ||
return x | ||
|
||
validate(foo) | ||
|
||
|
||
def test_basic_value(validate): | ||
@compile_guppy | ||
def foo() -> str: | ||
x = "Hello World" | ||
return x | ||
|
||
validate(foo) | ||
|
||
|
||
def test_struct(validate): | ||
module = GuppyModule("module") | ||
|
||
@guppy.struct(module) | ||
class StringStruct: | ||
x: str | ||
|
||
@guppy(module) | ||
def main(s: StringStruct) -> None: | ||
StringStruct("Lorem Ipsum") | ||
|
||
validate(module.compile()) |