on master help sign in
Never compile 'void'

Erasure analysis may fail to spot unused calls to void in higher order contexts, but since it can never be used in practice, make sure it doesn't compile to anything. This addresses #3088

commit6cbfdd32de26166262c7537137d61551cb40a4ef authorEdwin Brady <ecb10@st-andrews.ac.uk> dateFri 15 Apr 2016, 00:00 (11 years ago) parent6536663
1 file changed+6
src/IRTS/Compiler.hs+6
src/IRTS/Compiler.hs+6
@@ -246,6 +246,12 @@ irTerm vs env tm@(App _ f a) = do
246246 | r == txt "replace"
247247 -> irTerm vs env arg
248248
249+ -- 'void' doesn't have any pattern clauses and only gets called on
250+ -- erased things in higher order contexts (also a TMP HACK...)
251+ (P _ (UN r) _, _)
252+ | r == txt "void"
253+ -> return LNothing
254+
249255 -- Laziness, the old way
250256 (P _ (UN l) _, [_, arg])
251257 | l == txt "lazy"