Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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-internals/src/guppylang_internals/cfg/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from guppylang_internals.error import GuppyError, InternalGuppyError
from guppylang_internals.experimental import (
check_lists_enabled,
check_modifiers_enabled,
check_power_modifier_enabled,
)
from guppylang_internals.nodes import (
ComptimeExpr,
Expand Down Expand Up @@ -348,7 +348,6 @@ def visit_FunctionDef(
return bb

def visit_With(self, node: ast.With, bb: BB, jumps: Jumps) -> BB | None:
check_modifiers_enabled(node)
self._validate_modified_block(node)

# Build context expressions and extract modifiers before constructing the inner
Expand Down Expand Up @@ -404,6 +403,7 @@ def _handle_withitem(self, node: ast.withitem) -> Modifier:
raise GuppyError(WrongNumberOfArgsError(span, 1, len(e.args)))
modifier = Control(e, e.args)
case ast.Call(func=ast.Name(id="power")):
check_power_modifier_enabled(e.func)
if len(e.args) == 0:
span = Span(to_span(e.func).end, to_span(e).end)
raise GuppyError(WrongNumberOfArgsError(span, 1, len(e.args)))
Expand Down
11 changes: 4 additions & 7 deletions guppylang-internals/src/guppylang_internals/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ def check_capturing_closures_enabled(loc: AstNode | None = None) -> None:
raise GuppyError(UnsupportedError(loc, "Capturing closures"))


def check_modifiers_enabled(loc: AstNode | None = None) -> None:
def check_power_modifier_enabled(loc: AstNode | None = None) -> None:
if not EXPERIMENTAL_FEATURES_ENABLED:
raise GuppyError(ExperimentalFeatureError(loc, "Modifiers"))


def check_unitary_callable_enabled(thing: str, loc: AstNode | None = None) -> None:
if not EXPERIMENTAL_FEATURES_ENABLED:
raise GuppyError(ExperimentalFeatureError(loc, thing, singular_things=True))
raise GuppyError(
ExperimentalFeatureError(loc, "`power` modifier", singular_things=True)
)
3 changes: 0 additions & 3 deletions guppylang-internals/src/guppylang_internals/tys/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from guppylang_internals.diagnostic import Error
from guppylang_internals.engine import ENGINE
from guppylang_internals.error import GuppyError
from guppylang_internals.experimental import check_unitary_callable_enabled
from guppylang_internals.tys.arg import Argument, ConstArg, TypeArg
from guppylang_internals.tys.builtin import (
CallableTypeDef,
Expand Down Expand Up @@ -205,8 +204,6 @@ def _arg_from_instantiated_defn(
match defn:
# Special cases for the `Callable` type
case CallableTypeDef(flags=flags):
if flags != UnitaryFlags.NoFlags:
check_unitary_callable_enabled(flags.callable_name(), node)
return TypeArg(_parse_callable_type(arg_nodes, node, ctx, flags=flags))
# Special case for the `Self` type
case SelfTypeDef():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
Error: Experimental feature (at $FILE:6:4)
Error: Experimental feature (at $FILE:7:9)
|
4 | @guppy
5 | def main() -> None:
6 | with dagger:
| ^^^^^^^^^^^^
7 | pass
| ^^^^^^^^^^^^ Modifiers are an experimental feature
5 | @guppy
6 | def main() -> None:
7 | with power(2):
| ^^^^^ `power` modifier is an experimental feature

Help: Experimental features are currently disabled. You can enable them by
calling `guppylang.enable_experimental_features()`, however note that these
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from guppylang.decorator import guppy
from guppylang.std.builtins import power


@guppy
def main() -> None:
with dagger:
with power(2):
pass


Expand Down
12 changes: 0 additions & 12 deletions tests/error/experimental_errors/unitary_callable.err

This file was deleted.

22 changes: 0 additions & 22 deletions tests/error/experimental_errors/unitary_callable.py

This file was deleted.

Loading