Skip to content

Commit

Permalink
Make it more explicit that iid type checking is unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
Legotier committed Jun 2, 2022
1 parent 0da4e94 commit 6158b37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions probably/pgcl/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,12 @@ def _get_distribution_type(prog: Program, expr: Expr, check: bool = True) -> Uni
if isinstance(expr.sampling_dist, get_args(DistrExpr)):
return _get_distribution_type(prog, expr.sampling_dist, check)
else:
# we cannot check whether the sampling distribution as given by the program is actually a distribution
if check:
safe = check_expression(prog, expr.sampling_dist)
if isinstance(safe, CheckFail):
return safe
print(f"Type Checking is not accurate anymore (because of '{expr}').")
return NatType(bounds=None)

raise Exception("unreachable")
Expand Down
2 changes: 1 addition & 1 deletion probably/pgcl/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def check_is_linear_expr(expr: Expr, context: Program) -> Optional[CheckFail]:
:param expr:
:param not_a_variable: The context in which the expression is to be evaluated. Literals that are
parameters according to this context not considered variables.
parameters according to this context are not considered variables.
.. doctest::
Expand Down

0 comments on commit 6158b37

Please sign in to comment.