diff --git a/ssa/ssa_test.go b/ssa/ssa_test.go index 3ccbe147..838dd92a 100644 --- a/ssa/ssa_test.go +++ b/ssa/ssa_test.go @@ -21,6 +21,8 @@ import ( "go/token" "go/types" "testing" + + "github.com/goplus/llvm" ) /* @@ -30,6 +32,26 @@ func TestMakeInterface(t *testing.T) { } */ +func TestTypes(t *testing.T) { + ctx := llvm.NewContext() + llvmIntType(ctx, 4) + + intT := types.NewVar(0, nil, "", types.Typ[types.Int]) + ret := types.NewTuple(intT, intT) + sig := types.NewSignatureType(nil, nil, nil, nil, ret, false) + prog := NewProgram(nil) + prog.retType(sig) +} + +func TestIndexType(t *testing.T) { + defer func() { + if r := recover(); r == nil { + t.Log("indexType: no error?") + } + }() + indexType(types.Typ[types.Int]) +} + func TestCvtCType(t *testing.T) { test := func(typ types.Type) { defer func() { diff --git a/ssa/type.go b/ssa/type.go index 93feee6b..b983a22e 100644 --- a/ssa/type.go +++ b/ssa/type.go @@ -91,9 +91,11 @@ type aType struct { type Type = *aType +/* func (p Program) Slice(typ Type) Type { return p.Type(types.NewSlice(typ.t)) } +*/ func (p Program) Pointer(typ Type) Type { return p.Type(types.NewPointer(typ.t))