scripts/image-fixes/20-SlotErrorsTest.stSlotErrorsTest>>testCannotBeRecompiledtestCannotBeRecompiled was marked expectedFailure and asserted that the class builder raises an Error ("X cannot be recompiled") when the layout of a class that has a subclass changes to VariableLayout. That was the behaviour of the old ClassBuilder. The current builder (Smalltalk classInstaller) rebuilds the subclass with the new layout and raises nothing. The code under test works as designed, so the test expectation is obsolete on both VMs. The fix rewrites the test to check what the new builder does: the recompile succeeds, the superclass gets VariableLayout, the subclass is still a subclass of the rebuilt superclass, and the subclass has VariableLayout and isVariable. The expectedFailure pragma is removed. The assertions check the real behaviour and are not trivial.
| Test | Defect in | State | Cause |
|---|---|---|---|
SlotErrorsTest>>testCannotBeRecompiled |
test | repaired | Obsolete expectation: it expected the old class builder's 'cannot be recompiled' Error. The new builder rebuilds subclasses with the changed layout, so no Error is raised (should:raise: failed with 'Old class builder raises: X cannot be recompiled' on both VMs). Same behaviour on both VMs, so no VM defect. |
Regression check: Ran the whole SlotErrorsTest class on both VMs with the fix image and the base image. Ours: base 11 PASS 1 FAIL, with fix 12 PASS. Cog: base 11 PASS 1 FAIL, with fix 12 PASS. Only a test method changed, so no other class covers it. SlotClassBuilderTest is abstract and ran no tests (0 lines) in all four runs.
Upstream note: Title: SlotErrorsTest>>testCannotBeRecompiled: replace the obsolete expected failure with a check of the current behaviour. Description: The test expected the old class builder's "X cannot be recompiled" error, and was marked expectedFailure. The current class installer rebuilds subclasses when the superclass layout changes (here to VariableLayout) and raises nothing. The test now asserts that the recompile succeeds, that the superclass and the subclass have VariableLayout, and that the subclass is still attached to the rebuilt superclass. The pragma is removed. Project: pharo (Slot-Tests). This is a proposal only; the owner should review it before any upstream submission.
Last full sweeps of 2026-11-17: iospharo (sweep14-new14) and stock Cog with the Cog changes (sweepcogp14-new10), with all image fixes. "Before" is the state of the test before the repairs. The Stock Cog column has a value only where the record measured stock Cog: "PASS 3 of 3 (repair run)" is the check of each repair on stock Cog v12.0.6 with the fix entry; "-" is not measured separately.
| Test | Before | State | iospharo VM | Patched Cog | Stock Cog |
|---|---|---|---|---|---|
SlotErrorsTest>>testCannotBeRecompiled | XFAIL | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
Run the tests in a Pharo 14 image (build 791). Before the fix they skip, fail or carry the expected-failure mark.
"Run in a Playground of a Pharo 14 image (Do it and print each line)." ((SlotErrorsTest selector: #testCannotBeRecompiled) run) printString.
testCannotBeRecompiled | superclass | <expectedFailure> superclass := self make: [ :builder | builder superclass: Object; name: self aClassName ]. self make: [ :builder | builder superclass: superclass; name: self anotherClassName ]. self should: [ self make: [ :builder | builder layoutClass: VariableLayout; name: self aClassName ] ] raise: Error description: 'Old class builder raises: X cannot be recompiled'
How to apply an entries file: file in 00-header.st and the entries file as one chunk (the iospharo script scripts/gen-image-fixes.py makes that chunk). Each entry checks for the defect first and prints FIXED, ADDED or SKIP. Download 00-header.st.
fix value: #SlotErrorsTest value: #testCannotBeRecompiled value: [ :s | s includesSubstring: '<expectedFailure>' ] value: 'testCannotBeRecompiled "The new class builder (ClassBuilder replacement, Pharo 9+) can change the layout of a class that has subclasses: the subclasses are rebuilt with the new layout. The old builder raised ''X cannot be recompiled''. The test records that the new builder rebuilds the hierarchy and keeps the subclass in step." | superclass subclass | superclass := self make: [ :builder | builder superclass: Object; name: self aClassName ]. self make: [ :builder | builder superclass: superclass; name: self anotherClassName ]. superclass := self make: [ :builder | builder layoutClass: VariableLayout; name: self aClassName ]. subclass := superclass subclasses detect: [ :each | each name = self anotherClassName ]. self assert: superclass classLayout class equals: VariableLayout. self assert: subclass superclass equals: superclass. self assert: subclass classLayout class equals: VariableLayout. self assert: subclass isVariable'.
State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.