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

feat!: Make linear types @inout by default; add @owned annotation #486

Merged
merged 28 commits into from
Sep 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
40e9701
Drive-by: change name of parse_docstring
croyzor Sep 10, 2024
ec3072e
Drive-by: Say which identifiers are unknown
croyzor Sep 10, 2024
091802e
checkpoint: integration tests
croyzor Sep 11, 2024
1edb8f0
Update comprehension error tests
croyzor Sep 11, 2024
24e7d04
Update inout error files
croyzor Sep 11, 2024
d5db2e7
Update linear error files
croyzor Sep 11, 2024
e64155f
Update misc error tests
croyzor Sep 12, 2024
8a0976d
Only print the missing module for attributes
croyzor Sep 12, 2024
b982bc4
Update more error files
croyzor Sep 12, 2024
ea04238
Merge remote-tracking branch 'origin/main' into feat/owned
croyzor Sep 12, 2024
217d471
Fix printing of flags
croyzor Sep 12, 2024
718c2c7
Review comments
croyzor Sep 12, 2024
f07175a
Add new test case
croyzor Sep 12, 2024
6fa60fd
Update error files
croyzor Sep 12, 2024
8f9b7de
Review comment: update used_twice
croyzor Sep 12, 2024
8c911ee
revert pyproject change
croyzor Sep 12, 2024
45be26d
Shut up mypy
croyzor Sep 12, 2024
11d9642
Update references to @inout
croyzor Sep 12, 2024
fe69a36
Merge branch 'main' into feat/owned
croyzor Sep 12, 2024
df989bb
Take ownership of linear args to struct constructors
croyzor Sep 13, 2024
fc75c81
Add tests for linear struct initialisation
croyzor Sep 13, 2024
b8fe162
Make check an assert
croyzor Sep 13, 2024
b13e547
chore: Unskip now-passing tests (#475)
aborgna-q Sep 12, 2024
f32cd61
Merge remote-tracking branch 'origin/main' into feat/owned
croyzor Sep 13, 2024
a34d824
Update guppylang/tys/ty.py
croyzor Sep 13, 2024
46d32a1
Update guppylang/checker/linearity_checker.py
croyzor Sep 13, 2024
7c7e2d0
Update guppylang/tys/parsing.py
croyzor Sep 13, 2024
fdf10f2
Update tests; mypy annotations
croyzor Sep 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions guppylang/tys/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ def _try_parse_defn(node: AstNode, globals: Globals) -> Definition | None:
match node:
case ast.Name(id=x):
if x not in globals:
raise GuppyError("Unknown identifier", node)
raise GuppyError(f"Unknown identifier: {x}", node)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Drive-by: Printing the unknown identifiers here and on line 89

Copy link
Collaborator

Choose a reason for hiding this comment

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

See #479. It also makes the printed id show the module name instead of the object repr.

croyzor marked this conversation as resolved.
Show resolved Hide resolved
return globals[x]
case ast.Attribute(value=ast.Name(id=module_name) as value, attr=x):
if module_name not in globals:
raise GuppyError("Unknown identifier", value)
raise GuppyError(f"Unknown identifier: {module_name}.{x}", value)
croyzor marked this conversation as resolved.
Show resolved Hide resolved
module_def = globals[module_name]
if not isinstance(module_def, ModuleDef):
raise GuppyError(
Expand Down