lexi-lambda / hackett

WIP implementation of a Haskell-like Lisp in Racket
https://lexi-lambda.github.io/hackett/
ISC License
1.17k stars 50 forks source link

Add a missing syntax-track-origin #81

Closed AlexKnauth closed 6 years ago

AlexKnauth commented 6 years ago

This adds a call to syntax-track-origin to a place where it was missing in type-language.rkt.

In the case where a type macro expands to an identifier, the disappeared-use and origin etc. properties on that result identifier were being lost. This copies those properties onto the residual syntax object.

A simple program that this PR fixes is this:

#lang hackett

(require (only-in racket/base module quote))

(module m racket
  (provide m)
  (require syntax/parse/define)
  (define-syntax-parser m
    [(m x y)
     (syntax-property #'x
                      'disappeared-use
                      (syntax-local-introduce #'y))]))

(require (for-type 'm))

(def f : (∀ [x y] (m x y))  ; before: this `y` doesn't get an arrow
  (todo!))                  ; after: this `y` is properly shown as bound to the `y` in the forall
lexi-lambda commented 6 years ago

Thanks!