I've got three modules:
- One untyped module defines some structs
- One typed module defines some helper functions
- One typed module does some interesting things

I've also got a problem: I cannot share imported untyped structs between
the typed modules.

The problem goes away if I linearize the module dependencies, but I'd
prefer not to do that -- the situation I have in real life uses two
orthogonal modules of helper functions (so the overall inheritance graph is
a diamond).

Here's the minimal example. Can we at least make the error message more
helpful?

#lang racket/base

(module data-defn racket/base
  (provide (struct-out foo))
  (struct foo ()))

(module utils typed/racket/base
  (provide foo->string)
  (require/typed (submod ".." data-defn) [#:struct foo ()])
  (: foo->string (-> foo String))
  (define (foo->string f) "foo"))

(module main typed/racket/base
  (require/typed (submod ".." data-defn) [#:struct foo ()])
  (require (submod ".." utils))
  (: main (-> Void))
  (define (main)
    (displayln (foo->string (foo)))))

;; Type Checker: type mismatch
;;  expected: foo
;;  given: foo
;;  in: (foo)
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to