racket / racket/typed-racket

(∩ struct-type (→ t)) can't be used as a function, needs annotation

Open
#431 4 comments 0 reactions 1 assignee View on GitHub

@pnwamk is already working on this.

Since Oct 13, 2016.

Dominant language
Racket
Stars
575
Forks
106
Avg merge
2h 1m
Merged PRs (30d)
2

Description

What version of Racket are you using?

6.6.0.5

What program did you run?
#lang typed/racket

(define-struct foo ())

(λ ([x : (∩ foo (→ foo))])
  (x) ;; <==================== fails
  ((ann x (→ foo))))
What should have happened?

The program should typecheck without the need for the annotation, since the guarantees that x is already the right type.

The use case for this is to have define-struct/exec instances which behave transparently as functions too, once #430 is solved.

Note that if the type of x is (∩ Number (→ foo)) instead of (∩ foo (→ foo)), the program compiles fine, but the function's argument type gets reduced to Nothing (which is likely correct in this case).

If you got an error message, please include it here.
Type Checker: Cannot apply expression of type (∩ foo (-> foo)), since it is not a function type in: (x)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.