Summary
Specializations using "and" (and/or other macros) don't work properly
Metadata
- Id: 28ba8b51bcf13eda8b45a19694a33bf71777dbf3
- Trac id: 1690
- Type: defect
- Reporter: sjamaan
- Owner:
- Cc:
- Status: closed
- Component: unknown
- Estimated difficulty: medium
- Resolution: fixed
- Priority: major
- Milestone: 5.3
- Version: 5.2.0
- Changetime: 2020-03-27 07:33:12 UTC
- Created: 2020-03-24 19:50:23 UTC
- Keywords: specialization
Description
[[[https://lists.gnu.org/archive/html/chicken-hackers/2020-03/msg00012.html|Reported]|]] by Kon Lovett:
cat >matches-prob-test.scm <<'HERE'
(import scheme)
(import (chicken irregex))
(define (uses-predicate str)
(and
(string? str)
(irregex-match? '(: "foo") str) ) )
(print "uses-predicate: " (uses-predicate ""))
HERE
csc ./matches-prob-test.scm
./matches-prob-test
#uses-predicate: #f
csc -specialize ./matches-prob-test.scm
./matches-prob-test
#Error: unbound variable: and
Interestingly, this goes all the way back to 4.9.0; in 4.8.0.5 this program (with suitable changes for C4) works as expected with `-specialize`.
It looks like the `and` that's being complained about is the one in the `irregex-match?` specialization in `types.db`. This makes sense if the specialization is the last thing that happens, there's no more macro expansion step and stuff will break.
Changes and comments
[2020-03-24 20:18:11 UTC] sjamaan changed description
[2020-03-24 20:18:11 UTC] sjamaan changed summary
[2020-03-24 20:18:46 UTC] sjamaan changed milestone from 5.4 to 5.3
[2020-03-27 07:33:12 UTC] evhan changed status from new to closed
[2020-03-27 07:33:12 UTC] evhan set resolution to fixed
[2020-03-27 07:33:12 UTC] evhan wrote:
Fixed by d5e8cff27.