Subject: bug#30990: Should the byte compiler warn about :type mismatches?

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 09 Oct 2019 19:57:22 +0200

Robert Pluim <[email-masked]> writes:

> Hmm. Current attempt attached.

Looks good to me.

> Iʼm having trouble with
> 'sql-postgres-login-params', and 'sql-password-wallet', probably
> because I donʼt know enough about custom, suggestions welcome.

The first one should probably not be a defcustom at all, but perhaps
just...

:type 'sexp

The second looks like a bug:

(defcustom sql-password-wallet
  (let (wallet w)
    (dolist (ext '(".json.gpg" ".gpg" ".json" "") wallet)
      (unless wallet
        (setq w (locate-user-emacs-file (concat "sql-wallet" ext)
                                        (concat ".sql-wallet" ext)))
        (when (file-exists-p w)
          (setq wallet w)))))

It will always be nil, won't it?  My guess would be that the intention
was that this should be

(defcustom sql-password-wallet
  (let (wallet w)
    (dolist (ext '(".json.gpg" ".gpg" ".json" "") wallet)
      (unless wallet
        (setq w (locate-user-emacs-file (concat "sql-wallet" ext)
                                        (concat ".sql-wallet" ext)))
        (when (file-exists-p w)
          (setq wallet w))))
    wallet)

but I'm not familiar with this at all.  But if that's the case the type
should be a choice between nil and `file'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no