Commit 5a6e9dac
5a6e9dac61d2Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 6 files · +3 added · ~3 modified
Description
Merge pull request #1421 from rubys/fix/1417-boundary-coercion
Fix #1417: coerce poly values into RBS-pinned types at return/arg boundaries
Details
- Commit
- 5a6e9dac61d2
- Parent
- 482d4237e7ac
- Merge parent
- 93df441492a2
MakefilemodifiedView file
@@ -336,18 +336,22 @@
336336
rbs-seed-test:337337
@echo "rbs-seed-test: skipped (vendor/rbs not fetched; run 'make deps')"338338
else339-
rbs-seed-test: $(SPINEL) spinel_rbs_extract$(EXE)339+
rbs-seed-test: $(SPINEL) spinel_rbs_extract$(EXE) $(SP_RT_LIB)340340
@cp -f spinel_rbs_extract$(EXE) $(dir $(SPINEL))spinel_rbs_extract$(EXE)341-
@tmp=$$(mktemp -d /tmp/spinel-rbsseed.XXXXXX); \341+
@tmp=$$(mktemp -d /tmp/spinel-rbsseed.XXXXXX); ok=1; \342342
$(SPINEL) test/rbs-seed/nested_ivar.rb --rbs test/rbs-seed/sig \343343
-c --no-line-map -o "$$tmp/out.c" 2>/dev/null; \344-
ok=1; \345-
grep -Eq 'const char[[:space:]]+\*[[:space:]]*iv_label' "$$tmp/out.c" || ok=0; \346-
if grep -Eq 'sp_RbVal[[:space:]]+iv_label' "$$tmp/out.c"; then ok=0; fi; \347-
$(CC) -fsyntax-only -Ilib "$$tmp/out.c" 2>/dev/null || ok=0; \344+
grep -Eq 'const char[[:space:]]+\*[[:space:]]*iv_label' "$$tmp/out.c" || { echo "rbs-seed-test: FAIL (#1417: module-nested-class seed not applied)"; ok=0; }; \345+
if grep -Eq 'sp_RbVal[[:space:]]+iv_label' "$$tmp/out.c"; then echo "rbs-seed-test: FAIL (#1417: ivar stayed poly)"; ok=0; fi; \346+
$(CC) -fsyntax-only -Ilib "$$tmp/out.c" 2>/dev/null || { echo "rbs-seed-test: FAIL (nested_ivar C invalid)"; ok=0; }; \347+
$(SPINEL) test/rbs-seed/boundary.rb --rbs test/rbs-seed/sig \348+
-c --no-line-map -o "$$tmp/b.c" 2>/dev/null; \349+
if $(CC) -O0 -Ilib "$$tmp/b.c" $(SP_RT_LIB) -lm -o "$$tmp/b" 2>"$$tmp/b.err"; then \350+
"$$tmp/b" > "$$tmp/b.out" 2>/dev/null; \351+
cmp -s "$$tmp/b.out" test/rbs-seed/boundary.expected || { echo "rbs-seed-test: FAIL (#1417 boundary output mismatch)"; diff -u test/rbs-seed/boundary.expected "$$tmp/b.out" || true; ok=0; }; \352+
else echo "rbs-seed-test: FAIL (#1417 boundary coercion C did not compile)"; ok=0; fi; \348353
rm -rf "$$tmp"; \349-
if [ $$ok -eq 1 ]; then echo "rbs-seed-test: pass"; \350-
else echo "rbs-seed-test: FAIL (#1417: module-nested-class seed not applied)"; exit 1; fi354+
if [ $$ok -eq 1 ]; then echo "rbs-seed-test: pass"; else exit 1; fi351355
endif352356
353357
# Analyze-fail fixtures test the legacy analyzer's rejection diagnostics;src/codegen_fold.cmodifiedView file
Loading diff…
src/codegen_stmt.cmodifiedView file
Loading diff…
test/rbs-seed/boundary.expectedaddedView file
Loading diff…
test/rbs-seed/boundary.rbaddedView file
Loading diff…
test/rbs-seed/sig/boundary.rbsaddedView file
Loading diff…