Skip to content

Commit 6a2d7fc

Browse files
Add parameter type_inference_mode to kompile (runtimeverification/pyk#767)
And use `--type-inference-mode checked` when kompiling using the test fixtures. --------- Co-authored-by: devops <[email protected]>
1 parent 4fef74b commit 6a2d7fc

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

pyk/package/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.540
1+
0.1.541

pyk/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "pyk"
7-
version = "0.1.540"
7+
version = "0.1.541"
88
description = ""
99
authors = [
1010
"Runtime Verification, Inc. <[email protected]>",

pyk/src/pyk/ktool/kompile.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,20 @@ def __init__(self, kompile_command: str):
3030
super().__init__(f'Kompile command not found: {str}')
3131

3232

33+
class TypeInferenceMode(Enum):
34+
Z3 = 'z3'
35+
SIMPLESUB = 'simplesub'
36+
CHECKED = 'checked'
37+
DEFAULT = 'default'
38+
39+
3340
def kompile(
3441
main_file: str | Path,
3542
*,
3643
command: Iterable[str] = ('kompile',),
3744
output_dir: str | Path | None = None,
3845
temp_dir: str | Path | None = None,
46+
type_inference_mode: str | TypeInferenceMode | None = None,
3947
debug: bool = False,
4048
verbose: bool = False,
4149
cwd: Path | None = None,
@@ -48,6 +56,7 @@ def kompile(
4856
command=command,
4957
output_dir=output_dir,
5058
temp_dir=temp_dir,
59+
type_inference_mode=type_inference_mode,
5160
debug=debug,
5261
verbose=verbose,
5362
cwd=cwd,
@@ -115,6 +124,7 @@ def __call__(
115124
*,
116125
output_dir: str | Path | None = None,
117126
temp_dir: str | Path | None = None,
127+
type_inference_mode: str | TypeInferenceMode | None = None,
118128
debug: bool = False,
119129
verbose: bool = False,
120130
cwd: Path | None = None,
@@ -138,6 +148,10 @@ def __call__(
138148
temp_dir = Path(temp_dir)
139149
args += ['--temp-dir', str(temp_dir)]
140150

151+
if type_inference_mode is not None:
152+
type_inference_mode = TypeInferenceMode(type_inference_mode)
153+
args += ['--type-inference-mode', type_inference_mode.value]
154+
141155
if debug:
142156
args += ['--debug']
143157

pyk/src/pyk/testing/_kompiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from ..kllvm.importer import import_runtime
1212
from ..kore.pool import KoreServerPool
1313
from ..kore.rpc import BoosterServer, KoreClient, KoreServer
14-
from ..ktool.kompile import DefinitionInfo, Kompile
14+
from ..ktool.kompile import DefinitionInfo, Kompile, TypeInferenceMode
1515
from ..ktool.kprint import KPrint
1616
from ..ktool.kprove import KProve
1717
from ..ktool.krun import KRun
@@ -43,7 +43,7 @@ def __call__(self, main_file: str | Path, **kwargs: Any) -> Path:
4343
kompile = Kompile.from_dict(kwargs)
4444
if kompile not in self._cache:
4545
output_dir = self._path / self._uid(kompile)
46-
self._cache[kompile] = kompile(output_dir=output_dir)
46+
self._cache[kompile] = kompile(output_dir=output_dir, type_inference_mode=TypeInferenceMode.CHECKED)
4747

4848
return self._cache[kompile]
4949

0 commit comments

Comments
 (0)