﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1481	compiler type warning (but no need for a warning)	snoewchen		"In the attached file there are 3 versions of a procedure ""assq-val"" that returns the associated value to a given key.

The procedure distinguishes if ""assq"" found really just a pair or a list, so that
{{{
  (assq-val 'a '((a . ""b""))) => ""b"" ; obviously
  (assq-val 'a '((a ""b)) => ""b"" ; instead of '(""b"")
}}}

You can find 3 Variants in the file (all 3 variants should be semantically equal):

  a) assq-val-no-warning
  b) assq-val-warning
  c) assq-val-also-no-warning

The strange thing is that the compiler says (for version (b) ""assq-val-warning"")

{{{
Warning: in toplevel procedure `assq-val-warning':
  (...:21) in procedure call to `cdr', expected argument #1 
  of type `pair' but was given an argument of type `false'
}}}

The call ""(cdr el)"" is in the if-branch of ""(if (pair? el)"" - so no risk for ""el"" to be #f.

What's even more perplexing - version (c) of ""assq-val"" is the same as version (b) - just the ""let""-form of version (b) is replaced by a ""define"" - and with that change the compiler warning goes away.

(I discovered the warning the other way around actually - beeing a scheme rookie the first version had the ""define"" form (more beginner friendly because less parens) - after some days of hacking I replaced the ""define""-form with let - and boom - compiler warning.)

My chicken version:
{{{
(c) 2008-2017, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 4.13.0 (rev 68eeaaef)
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2017-12-11 on yves.more-magic.net (Linux)
}}}"	defect	closed	minor	someday	compiler	4.13.0	fixed	compiler warning		
