freenode/#sbcl - IRC Chatlog
Search
7:52:50
flip214
When a type mismatch is detected during compilation (but reported "only" as a warning?!), quite a few "deleting unreachable code" notes are thrown as well.
7:53:34
flip214
how about dropping the unreachable notes? They get reported first and might confuse people; the important thing is the type mismatch anyway!
10:34:35
aeth
flip214: What happens is that the code gets compiled into the runtime error that must happen. So (progn (+ "Hello" "world") 42) deletes the 42 because the previous form must be a type error since strings aren't numbers.
10:55:45
flip214
aeth: I'm proposing to drop "unreachable code" notes that occur _after_ some bad code - they just fill up the compiler output and don't help to find the original bug.
11:19:13
aeth
flip214: It might be unintentional, actually. I wasn't seeing it because I was using + and it doesn't show up there. It does show up when I compile a file containing a function with type declarations and use that function instead of +, or when I just compile that function after first doing (setf sb-ext:*derive-function-types* t)
11:54:45
aeth
stassats: yes, I realized that and replaced it with (format t "Hello!~%") in my later tests. I didn't want to flood the channel, though
12:06:51
aeth
The deleting unreachable code note seems to be on the problem with types line, and not the lines below, though.
12:55:15
pfdietz
aeth: the other thing that happens is the secondary and tertiary return values of COMPILE are true. This happens even if the erroneous code is unreachable, if the compiler cannot determine that.
12:55:55
pfdietz
(compile nil '(lambda (x y z) (if (and (= x y) (= x z) (not (= y z))) (+ 'a) nil))) ==> <fn>, T, T (and warning text is emitted)