|
327 | 327 |
|
328 | 328 | (begin-for-syntax |
329 | 329 | ; fixity : [Maybe Fixity] |
330 | | - (struct val-decl [internal-id type exact? fixity] |
| 330 | + (struct val-decl [internal-id |
| 331 | + type |
| 332 | + type-unexpanded |
| 333 | + exact? |
| 334 | + fixity] |
331 | 335 | #:property prop:procedure |
332 | 336 | (λ (this stx) |
333 | | - (match-define (val-decl x- type _ _) this) |
| 337 | + (match-define (val-decl x- type _ _ _) this) |
334 | 338 | ((make-typed-var-transformer x- type) stx)) |
335 | 339 | #:property prop:infix-operator |
336 | 340 | (λ (this) (val-decl-fixity this))) |
337 | 341 |
|
338 | 342 | (define-syntax-class id/val-decl |
339 | 343 | #:attributes [internal-id |
340 | | - type.expansion type.scoped-binding-introducer |
| 344 | + type-unexpanded |
341 | 345 | exact? |
342 | 346 | fixity] |
343 | 347 | [pattern (~var x (local-value val-decl?)) |
344 | | - #:do [(match-define (val-decl x-* type* exact?* fixity*) |
| 348 | + #:do [(match-define (val-decl x-* _ type* exact?* fixity*) |
345 | 349 | (attribute x.local-value))] |
346 | | - #:attr internal-id (syntax-local-introduce x-*) |
347 | | - #:with type:type (syntax-local-introduce type*) |
348 | | - #:attr exact? exact?* |
349 | | - #:attr fixity fixity*])) |
| 350 | + #:attr internal-id (syntax-local-introduce x-*) |
| 351 | + #:with type-unexpanded (syntax-local-introduce type*) |
| 352 | + #:attr exact? exact?* |
| 353 | + #:attr fixity fixity*])) |
350 | 354 |
|
351 | 355 | ;; --------------------------------------------------------------------------------------------------- |
352 | 356 |
|
|
397 | 401 | ; will be understood by `def`. |
398 | 402 | [_ |
399 | 403 | (syntax-parse stx |
400 | | - [(_ x:id {~type t:type} |
| 404 | + [(_ x:id t_unexpanded:expr |
401 | 405 | {~alt {~optional {~and #:exact exact?}} |
402 | 406 | {~optional f:fixity-annotation}} |
403 | 407 | ...) |
404 | 408 | #:with x- (generate-temporary #'x) |
405 | 409 | #:with exct? (and (attribute exact?) #true) |
406 | 410 | #:with fixity (attribute f.fixity) |
| 411 | + #:with {~type t:type} #'t_unexpanded |
407 | 412 | #:with t_reduced (if (attribute exact?) |
408 | 413 | #'t.expansion |
409 | 414 | (type-reduce-context #'t.expansion)) |
410 | 415 | #'(define-syntax x |
411 | | - (let-values ([() t.residual]) |
412 | | - (val-decl (quote-syntax x-) |
413 | | - (quote-syntax t_reduced) |
414 | | - 'exct? |
415 | | - 'fixity)))])]))) |
| 416 | + (val-decl (quote-syntax x-) |
| 417 | + (quote-syntax t_reduced) |
| 418 | + (quote-syntax t_unexpanded) |
| 419 | + 'exct? |
| 420 | + 'fixity))])]))) |
416 | 421 |
|
417 | 422 | (define-syntax-parser λ1 |
418 | 423 | [(_ x:id e:expr) |
|
441 | 446 | #:literals [:] |
442 | 447 | [(_ x:id/val-decl e:expr) |
443 | 448 | #:with x- #'x.internal-id |
| 449 | + #:with {~type t:type} #'x.type-unexpanded |
| 450 | + #:with t_reduced (if (attribute x.exact?) |
| 451 | + #'t.expansion |
| 452 | + (type-reduce-context #'t.expansion)) |
444 | 453 | (syntax-property |
445 | | - #`(define- x- (: #,((attribute x.type.scoped-binding-introducer) |
446 | | - #'e) |
447 | | - x.type.expansion |
448 | | - #:exact)) |
| 454 | + #`(define- x- |
| 455 | + (let-values ([() t.residual]) |
| 456 | + (#%expression |
| 457 | + (: #,((attribute t.scoped-binding-introducer) |
| 458 | + #'e) |
| 459 | + t_reduced |
| 460 | + #:exact)))) |
449 | 461 | 'disappeared-use |
450 | 462 | (syntax-local-introduce #'x))] |
451 | 463 |
|
|
0 commit comments