stan-dev / stan-dev/stanc3

Partial evaluator should not silently swallow errors

Open
#1,125 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cleanup good first issue optimization
Dominant language
OCaml
Stars
160
Forks
59
Avg merge
21h 45m
Merged PRs (30d)
26

Description

If the partial evaluator replaces one function call with another, it checks that the new function is well-typed for it's arguments. This only seems to be there as a sanity check/safeguard against bad implementation of partial evaluation. This safeguard doesn't even check the return type is correct, just that the function is callable.

Non-function evaluations (such as when the result is evaluated all the way down to a literal value) are not checked at all.

If we'd like to keep this kind of check, it would be more useful throw an exception instead of silently suppressing the invalid partial evaluation.

Originally discussed with @nhuurre in https://github.com/stan-dev/stanc3/pull/1115#discussion_r810026326

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the partial evaluator implementation and its existing validation paths. Trace both function-call replacements and non-function results such as literals; done when invalid partial evaluations are no longer silently suppressed and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.