racket / racket/draw

Internal error when getting pen% and brush% color

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

Nobody has claimed this yet.

Dominant language
Racket
Stars
19
Forks
24
PR merge metrics
No merged PRs in 30d

Description

I happened to try this while looking into https://github.com/racket/gui/issues/307:

#lang racket/base

(require racket/class
         racket/draw)
(define p (new pen%))
(send p get-color)
(send p set-color "notacolor")
(send p get-color)

=>

(object:color% ...)
get-color: broke its own contract
  promised: (is-a?/c color%)
  produced: #f
  in: the range of
      the get-color method in
      brush%/c
  contract from:
      <pkgs>/draw-lib/racket/draw.rkt
  contract on: brush%
  blaming: <pkgs>/draw-lib/racket/draw.rkt
   (assuming the contract is correct)
  at: <pkgs>/draw-lib/racket/draw.rkt:85:19
  context...:
   /Users/bogdan/sandbox/racket/racket/collects/racket/contract/private/blame.rkt:346:0: raise-blame-error
   .../private/arrow-higher-order.rkt:375:33
   body of "/var/folders/11/9c7x7y096r9g35f9th6b93qc0000gn/T/tmp.ArY5q8ZT/draw.rkt"

The brush% class has the same issue.

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 with the contract at pkgs/draw-lib/racket/draw.rkt:85 and inspect the pen% and brush% get-color/set-color behavior. Run the Racket reproducer from the issue, including the invalid color, and compare both classes. Done means the reported operation no longer produces an internal contract error and its behavior is covered consistently for pen% and brush%.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
43/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.