on master help sign in
Merge pull request #594 from JanBessai/NullPtr
81632d7Edwin Brady
src/IRTS/CodegenJava.hs+2
@@ -486,6 +486,8 @@ mkExp pp (SOp LPar [arg]) =
486 (Nothing <>@! arg) >>= ppExp pp
486 (Nothing <>@! arg) >>= ppExp pp
487mkExp pp (SOp LNoOp args) =
487mkExp pp (SOp LNoOp args) =
488 (Nothing <>@! (last args)) >>= ppExp pp
488 (Nothing <>@! (last args)) >>= ppExp pp
489+mkExp pp (SOp LNullPtr args) =
490+ ppExp pp $ Lit Null
489mkExp pp (SOp op args) =
491mkExp pp (SOp op args) =
490 (mkPrimitiveFunction op args) >>= ppExp pp
492 (mkPrimitiveFunction op args) >>= ppExp pp
491
493
test/README+5−1
@@ -27,8 +27,12 @@ Tests:
27025: memory effects
27025: memory effects
28026: simple file-I/O-based type provider
28026: simple file-I/O-based type provider
29027: class constraints in using block
29027: class constraints in using block
30−028:
30+028: hello world with comment and block comment syntax in idr file
31029: match_refine and apply by type
31029: match_refine and apply by type
32+030: %reflection for functions running on syntax
33+031: error reflection
34+032: control idris via stdin
35+033: null pointer creation and check
32
36
33regxxx: various regression tests
37regxxx: various regression tests
34reg020: working strlen
38reg020: working strlen
test/test033/expected+1−1
@@ -1 +1 @@
1−0
1+True
test/test033/run+2−3
@@ -1,5 +1,4 @@
1#!/bin/bash
1#!/bin/bash
2−gcc -c test033.c
3−idris -o test033 test033.idr
2+idris $@ -o test033 test033.idr
4./test033
3./test033
5−rm -f *.ibc *.o test033
4+rm -f *.ibc test033
test/test033/test033.cdeleted−10
@@ -1,10 +0,0 @@
1−#include "test033.h"
2−#include <stddef.h>
3−
4−int testNull(void* p) {
5− if(p == NULL) {
6− return 0;
7− }
8− return 1;
9−}
10−
test/test033/test033.hdeleted−6
@@ -1,6 +0,0 @@
1−#ifndef __TEST033_H__
2−#define __TEST033_H__
3−
4−int testNull(void*);
5−
6−#endif
test/test033/test033.idr+1−7
@@ -1,10 +1,4 @@
1module Main
1module Main
2
2
3−%include C "test033.h"
4−%link C "test033.o"
5−
6−testNull : Ptr -> IO Int
7−testNull p = mkForeign (FFun "testNull" [FPtr] FInt) p
8−
9main : IO ()
3main : IO ()
10−main = testNull null >>= (putStrLn . show)
4+main = nullPtr null >>= (putStrLn . show)