Skip to content

Instantly share code, notes, and snippets.

@pedro-w
Last active January 11, 2018 13:31
Show Gist options
  • Save pedro-w/349666174fadef8b7e72bab40ebd2bf4 to your computer and use it in GitHub Desktop.
Save pedro-w/349666174fadef8b7e72bab40ebd2bf4 to your computer and use it in GitHub Desktop.
Strange dylan compile warnings
METHOD test-no-warnings () => ()
[CONGRUENT-CALLi ^{<&method> h? ()}()]
*t8(0) := [VALUES]
return *t8(0)
END
METHOD h? () => (#rest results)
*t1(1) := [VALUES ^#f]
return *t1(1)
END
METHOD test-warnings () => ()
t1 := [CONGRUENT-CALLi ^{<&method> h? ()}()]
IF (t1)
t7 := [PRIMOP cast-pointer-as-raw(^#f)]
ELSE
t8 := [PRIMOP cast-pointer-as-raw(^#f)]
END IF
{{ x }} := [IF-MERGE t7 t8]
t9 := [PRIMOP cast-raw-as-pointer({{ x }})]
*t6(0) := [CALLx ^{<&method> g (<object>)}(t9)] // tail call
return *t6(0)
END
METHOD g (k :: <object>) => (#rest results)
*t1(1) := [VALUES ^#f]
return *t1(1)
END
define function h?()
end;
define inline function g(k :: <object>)
end function;
define inline function f(p :: <raw-address>) => ();
end function;
define function test-warnings() => ()
let x = if (h?()) end;
let p = primitive-cast-pointer-as-raw(x);
f(p);
g(x);
end function;
define function test-no-warnings() => ()
let x = if (h?()) end;
let p = primitive-cast-pointer-as-raw(x);
g(x);
end function;
@pedro-w
Copy link
Author

pedro-w commented Jan 11, 2018

Simplified. Now the warning is

Serious warning - Invalid type for argument k in call to method g (k :: <object>) => (#rest results :: <object>):  <raw-pointer> supplied, <object> expected.
        ----
        g(x);
        ----

it's like homeopathy for code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment