Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

Internal error from tspec-pred #39

Open
soegaard opened this issue Aug 2, 2015 · 2 comments
Open

Internal error from tspec-pred #39

soegaard opened this issue Aug 2, 2015 · 2 comments

Comments

@soegaard
Copy link

soegaard commented Aug 2, 2015

I ran into this error:

../../nanopass-framework-racket/private/pass.rkt:1188:42: tspec-pred: contract violation
expected: tspec?
given: #f
in: the 1st argument of
(-> tspec? (or/c #f identifier?))
contract from:
/nanopass-framework-racket/private/records.rkt
blaming: /nanopass-framework-racket/private/pass.rkt
(assuming the contract is correct)
at: /nanopass-framework-racket/private/records.rkt:79.5

@soegaard
Copy link
Author

soegaard commented Sep 4, 2015

Here is a file that provokes a the error:

https://gist.github.com/soegaard/0a351e4d2be4f3b19c37

@soegaard
Copy link
Author

soegaard commented Sep 5, 2015

The stack trace highlights this part of pass.rkt

(let f ([pclause* pclause*] [alt-tree alt-tree] [rcond-rec-cl* '()] [rcond-case-cl* '()])
          #;(printf "length pclause*: ~s\n" (length pclause*))
          (if (null? pclause*)
              (values (reverse rcond-rec-cl*) (reverse rcond-case-cl*) alt-tree)
              (let* ([pclause (car pclause*)] [alt (nano-meta-alt (pclause-lhs pclause))])
                ; (displayln pclause)
                (let-values ([(related-pclause* other-pclause*)
                               (partition-pclause* alt pclause (cdr pclause*))])
                  #;(printf "alt: ~s, length related-pclause*: ~s, other-pclause*: ~s\n"
                    (syntax->datum (alt-syn alt)) (length related-pclause*) (length other-pclause*))
                  (with-syntax ([body (make-clause alt related-pclause* else-id)])
                    (cond
                      [(pair-alt? alt)
                        (f other-pclause* (remove-alt alt alt-tree) rcond-rec-cl*
                          (cons #`[(eqv? tag #,(pair-alt-tag alt)) body] rcond-case-cl*))]
                      [(terminal-alt? alt)
                       (f other-pclause* (remove-alt alt alt-tree)
                          (cons #`[(#,(tspec-pred (terminal-alt-tspec alt (language-tspecs ilang))) #,fml)
                                   body]
                                rcond-rec-cl*)
                          rcond-case-cl*)]
                      [else
                        (let ([ntspec (nonterminal-alt-ntspec alt (language-ntspecs ilang))])
                          (let ([maybe-term-pred? (ntspec-all-term-pred ntspec)])
                            (f other-pclause* (remove-alt alt alt-tree)
                              (if maybe-term-pred?
                                  (cons #`[(#,maybe-term-pred? #,fml) body] rcond-rec-cl*)
                                  rcond-rec-cl*)
                              (with-syntax ([(all-tag ...) (ntspec-all-tag ntspec)])
                                (cons #`[(let ([t (bitwise-and tag #,(language-tag-mask ilang))]) (or (= t all-tag) ...)) body] rcond-case-cl*)))))]))))))

akeep added a commit that referenced this issue Sep 7, 2015
…ser's

define-pass.  what seemed to be happening is that using the identifier of the
type was causing variable capture, when the identifier was also bound to a
syntax form.  worked around the problem by simply using a symbol, instead of an
identifier here.  I believe this fixes issue #39.
  private/meta-parser.rkt, private/records.rkt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant