Opened 5 years ago

Closed 5 years ago

#1690 closed defect (fixed)

Specializations using "and" (and/or other macros) don't work properly

Reported by: sjamaan Owned by:
Priority: major Milestone: 5.3
Component: unknown Version: 5.2.0
Keywords: specialization Cc:
Estimated difficulty: medium

Description (last modified by sjamaan)

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.

Change History (3)

comment:1 Changed 5 years ago by sjamaan

Description: modified (diff)
Summary: Specialization breaks "and" macro?Specializations using "and" (and/or other macros) don't work properly

comment:2 Changed 5 years ago by sjamaan

Milestone: 5.45.3

comment:3 Changed 5 years ago by evhan

Resolution: fixed
Status: newclosed

Fixed by d5e8cff27.

Note: See TracTickets for help on using tickets.