Skip to content

Commit

Permalink
minor edits from review with GG
Browse files Browse the repository at this point in the history
  • Loading branch information
cpurdy committed Sep 16, 2024
1 parent 9792d6b commit aed4ec3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions lib_ecstasy/src/main/x/ecstasy/collections/MapSet.x
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ class MapSet<Element>

/**
* Conditional [Freezable] implementation.
*
* Warning: The [freeze] method contract as specified below is that the same type is returned,
* i.e. MapSet is frozen to a MapSet, ListSet is frozen to a ListSet, and HashSet is frozen to a
* HashSet, etc. When subclassing [MapSet], this contract must be upheld, or the [freeze] method
* signature of the subclass must be overridden to widen the contract to allow the `freeze`
* method to return a [ListSet], because the implementation of [MapSetFreezer.freeze] returns a
* `ListSet` instead of an instance of the subclass when the [MapSet.contents] map is not
* [Freezable].
*/
static mixin MapSetFreezer<Element extends Shareable>
into MapSet<Element>
Expand Down
4 changes: 2 additions & 2 deletions lib_ecstasy/src/main/x/ecstasy/maps/ListMap.x
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class ListMap<Key, Value>
*
* @return a `Value[]` `Array` full of `Nulls`
*/
Value[] makeNulls(Int size, Mutability? mutability = Null) {
protected Value[] makeNulls(Int size, Mutability? mutability = Null) {
return new Value[](size)
.fill(Null.as(Value), 0..<size)
.toArray(mutability, inPlace=True);
Expand Down Expand Up @@ -629,7 +629,7 @@ class ListMap<Key, Value>

@Override
MapEntry reify() {
return cursor ? new MapEntry(key) : this;
return cursor && verifyNoSurprises() ? new MapEntry(key, index) : this;
}

/**
Expand Down

0 comments on commit aed4ec3

Please sign in to comment.