Skip to content

TR-contract translation with twin or/c causes problems #1082

Open
@jbclements

Description

@jbclements

What version of Racket are you using?

8.0.900

What program did you run?

#lang racket

(module foo typed/racket

 (provide f)

 (define-type Untidy (U (Pair 1 Any) (Pair 0 Any)))

 (define (f [val : Any]) : (U False Untidy)
   (cons 1 0)))

(require 'foo)

(f 123)

(Thanks to @mfelleisen for reducing the failure.)

What should have happened?

program should have evaluated to (cons 1 0)

If you got an error message, please include it here.

../../Applications/Racket v8.0.900/collects/racket/contract/private/blame.rkt:346:0: f: broke its own contract
  two of the clauses in the or/c might both match: (cons/c any/c Any) and (cons/c any/c Any)
  produced: '(1 . 0)
  in: the range of
      (->
       any/c
       (or/c
        #f
        (cons/c any/c Any)
        (cons/c any/c Any)))
  contract from: (anonymous-module foo)
  blaming: (anonymous-module foo)
   (assuming the contract is correct)
  at: 13-unsaved-editor:10.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions