racket / racket/typed-racket

`for/and` expects body to return `Boolean` regardless of annotation

Open
#121 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This is in Racket snapshot 6.2.0.2--2015-03-26(56a701b/a).

The following expression does not type check:

(for/and : Any ([i (list)]) 42)
; /tmp/test/test.rkt:3:0: Type Checker: type mismatch
;   expected: Boolean
;   given: Positive-Byte
;   in: (for/and : Any ((i (list))) 42)

This one gives more errors, if that helps:

(for/and : (U #f Integer) ([i (list)]) 42)
; /tmp/test/test.rkt:3:0: Type Checker: type mismatch
;   expected: Boolean
;   given: Positive-Byte
;   in: (for/and : (U #f Integer) ((i (list))) 42)
; /tmp/test/test.rkt:3:0: Type Checker: type mismatch
;   expected: (U Integer False)
;   given: Boolean
;   in: (for/and : (U #f Integer) ((i (list))) 42)
; /tmp/test/test.rkt:3:0: Type Checker: type mismatch
;   expected: (U Integer False)
;   given: Boolean
;   in: (for/and : (U #f Integer) ((i (list))) 42)
; Type Checker: Summary: 3 errors encountered

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.

Research direction

Start by reproducing the two for/and expressions from the issue in the referenced Racket snapshot and inspect the Typed Racket type-checking path for for/and. Done means the body is no longer incorrectly required to return Boolean when an annotation permits another result type, without introducing the additional reported errors.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.