You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> (module test racket/base
(require racket/contract)
(provide (contract-out #:forall (a?)
(struct test ((a a?)))))
(struct test (a)))
> (require 'test)
> (test 1)
test: broke its own contract
not a?: 1
in: the 1st argument of
(-> a? test?)
contract from: top-level
blaming: top-level
(assuming the contract is correct)
at: string:7:10
[,bt for context]
What should have happened?
The first a? in the contract shown in the error message is in the negative position so that the value 1 should have been accepted anyway and wrapped in an opaque struct.
If you got an error message, please include it here.
The context may be helpful.
> ,bt
test: broke its own contract
not a?: 1
in: the 1st argument of
(-> a? test?)
contract from: top-level
blaming: top-level
(assuming the contract is correct)
at: string:7:10
context...:
/usr/racket/share/racket/collects/racket/contract/private/blame.rkt:350:0: raise-blame-error
/usr/racket/share/racket/collects/racket/contract/private/arrow-val-first.rkt:486:18
/usr/racket/share/racket/pkgs/xrepl-lib/xrepl/xrepl.rkt:1573:0
/usr/racket/share/racket/collects/racket/repl.rkt:11:26
Please include any other relevant details (test 1 add1) returns an instance of the test structure type in Racket8.12.
Besides, a procedure that is not a structure constructor and is protected by a similar contract works fine.
What version of Racket are you using?
What program did you run?
What should have happened?
The first
a?
in the contract shown in the error message is in the negative position so that the value1
should have been accepted anyway and wrapped in an opaque struct.If you got an error message, please include it here.
The context may be helpful.
Please include any other relevant details
(test 1 add1)
returns an instance of thetest
structure type in Racket8.12.Besides, a procedure that is not a structure constructor and is protected by a similar contract works fine.
The text was updated successfully, but these errors were encountered: