Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • I iterate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 18
    • Issues 18
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • iterate
  • iterate
  • Issues
  • #9
Closed
Open
Issue created May 14, 2021 by Robert Goldman@rgoldmanMaintainer

When a driver variable has a type declaration, we get a spurious warning

This issue is demonstrated by a new test that I have written:

;;; this test catches problems with make-initial-value, which cannot find a good initial
;;; value for cases where the initial value should be NIL.  This causes generation of a
;;; spurious warning.
(deftest type.8
    (catch 'warned
      (handler-bind ((simple-warning #'(lambda (w) (throw 'warned (format nil "~a" w))))
                     (error #'(lambda (w) (throw 'warned (format nil "~a" w)))))
        (let ((vec (vector (make-instance 'polar :mag 2) (make-instance 'polar :mag 4))))
          (nth-value 1
                     (iter (for x in-vector vec with-index i)
                       (declare (type (or null polar) x) (type fixnum i))
                       (with-slots (rho) x
                         (finding x such-that (= rho 4) into target))
                       (finally (return (values target i))))))))
  1)

This gives:

Expected value: 1
Actual value: "Iterate, in clause (FOR X IN-VECTOR VEC WITH-INDEX I):
Cannot supply an initial value for type (OR NULL POLAR); using NIL.".

... which clearly shows the problem -- NIL is a perfectly fine initial value for type (OR NULL POLAR).

I believe I have a patch that fixes this. Will post a MR ASAP.

Edited May 14, 2021 by Robert Goldman
Assignee
Assign to
Time tracking