Repository navigation
Compute erased types from new-resolution shape analysis #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LPTK
wants to merge
35
commits into
hkust-taco:hkmc2
Choose a base branch
from
LPTK:compute-erased-types-from-shapes
base: hkmc2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6,652
−1,711
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
484eafb
WIP
LPTK 45842c6
Compute runtime erased types from completed resolution shapes
codex fca467d
WIP
LPTK 0629de9
Shorten i32 constants in erasure regressions
codex 1f5390b
Eliminate casts made redundant by IR simplification
codex f853f10
Preserve function representations when lowering lambdas
codex 551e4a8
Preserve representations across deforestation rewrites
codex 3caffd0
Preserve checked arguments when propagating partial calls
codex 35fa0bd
Fuse constructors through casts proved by flow analysis
codex c6b0f63
Preserve existing spacing in Wasm regression tests
codex d41909e
Merge branch 'hkmc2' into compute-erased-types-from-shapes
codex b87501d
Address review of erased types computed from shapes
claude e5e6126
Update golden output for shifted internal-error line numbers
claude d710d52
Infer the representation of the temporary saved by `set … in`
claude eb47bae
Merge branch 'hkmc2' into compute-erased-types-from-shapes
codex 8bfe6a3
Infer representations of mutable fields from their assignments
claude 1b878f2
Declare mutable record fields with `mut`
claude c0af69c
Update golden output after rebasing mutable-field work
claude 9539de3
test: cover values escaping through mutable record assignments
codex 081891b
Fix mutable-field exposure and preserve read/write variance
codex 632d227
test: verify both mutable record constraint directions
codex 6cdba57
Merge optional-params and reconcile shape-based erasure
codex 65660c4
Fix review regressions in exposure, overrides, and fusion
codex e997c04
Merge hkmc2 and preserve consolidated regression coverage
codex 159f6c7
add tests
ychenfo aec9ed6
tweaks
ychenfo c43cf3d
keep constructors unfused in fields that cannot hold their fused form
ychenfo 3ca8e62
type the temporary holding a fused nullary constructor's closure
ychenfo 852c5b1
cast calls replacing fused matches into the enclosing result
ychenfo 5fa7f42
copy functions at the instances whose types fusion changes
ychenfo 65fb4b7
wip
ychenfo 4d9026e
replace unproducible values that causes erased type error in flow-typ…
ychenfo b982195
update type for eta and dpe
ychenfo e1e4d60
test: reproduce deforestation error for unboxed returns
codex 83440c8
Merge pull request #33 from ychenfo/compute-erased-types-from-shapes-…
LPTK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package hkmc2 | ||
| package semantics | ||
|
|
||
| import org.scalatest.funsuite.AnyFunSuite | ||
| import hkmc2.utils.* | ||
|
|
||
| /** Diff tests exercise representations. This checks the separate ownership property: | ||
| * consumers and later worksheet blocks cannot mutate completed observation snapshots. | ||
| */ | ||
| class ErasureInputsTest extends AnyFunSuite: | ||
| test("completed observations are isolated from worksheet and import consumers"): | ||
| given owner: Elaborator.State = new Elaborator.State | ||
| given defining: ResolutionContext = owner.newResolverState.context | ||
| val inputs = owner.newResolverState.erasureInputs | ||
| val symbol = VarSymbol(new syntax.Tree.Ident("value")) | ||
| val source = new TermShapeHost | ||
| inputs.register(symbol)(source.subscribeToShapes) | ||
| val initial = DynShape() | ||
| source.publish(initial) | ||
| defining.completeBlock(Term.UnitVal()) | ||
| val snapshot = inputs.shapes(symbol) | ||
| val first = new Elaborator.State().newResolverState.context | ||
| val second = new Elaborator.State().newResolverState.context | ||
| val later = UnknownValueShape.at(Term.UnitVal()) | ||
| val other = UnknownValueShape.at(Term.Lit(syntax.Tree.IntLit(1))) | ||
| source.publish(later)(using first) | ||
| source.publish(other)(using second) | ||
| source.publish(other)(using defining) | ||
| assert(source.currentShapes(using first).toSet == Set(initial, later)) | ||
| assert(source.currentShapes(using second).toSet == Set(initial, other)) | ||
| assert(source.currentShapes(using defining).toSet == Set(initial, other)) | ||
| assert(snapshot == List(initial)) | ||
| assert(inputs.shapes(symbol) == snapshot) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Claude] As @LPTK asked, the two design decisions from my review are now explicit:
undefinedis an unspecified value, and reading it back is undefined behavior. This is documented here, in the literal table above, and inBlock.isUndefined.Erasureclass documentation.This section also covers interface exposure, worksheets, overrides, and the builtin-operator approximation.