Skip to content

Instantly share code, notes, and snippets.

@pschanely
Created July 19, 2024 22:02
Show Gist options
  • Save pschanely/003b8cd3a5a0042922d8cae31f29a20e to your computer and use it in GitHub Desktop.
Save pschanely/003b8cd3a5a0042922d8cae31f29a20e to your computer and use it in GitHub Desktop.
Shared via CrossHair Playground
from crosshair.core_and_libs import proxy_for_type, standalone_statespace
from pathlib import PurePath
from crosshair.core import NoTracing
from crosshair.libimpl.builtinslib import (LazyIntSymbolicStr, SymbolicBoundedIntTuple)
with standalone_statespace:
with NoTracing():
# Any of these definitions will exhibit the issue,
# because we don't really do anything with the string:
# The usual way:
symbolic = proxy_for_type(str, "tempname")
# And the more internal way to do the same thing:
symbolic = LazyIntSymbolicStr("tempname")
# A "symbolic" string that only has one interpretation, the string "hi":
symbolic = LazyIntSymbolicStr([ord("h"), ord("i")])
# # a symblic string that can represent any hexidecimal string:
symbolic = LazyIntSymbolicStr(
SymbolicBoundedIntTuple([(ord("a"), ord("f")), (ord("0"), ord("9"))], "tempname")
)
PurePath(symbolic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment