Introduce typed semantic analysis pipeline
This commit is contained in:
parent
117d188194
commit
f4cd4f4458
30 changed files with 2079 additions and 2381 deletions
|
|
@ -26,18 +26,15 @@ fun optional(): Repository? { return null }`)
|
|||
}
|
||||
}
|
||||
|
||||
func TestExplicitClassPointerRemainsCompatible(t *testing.T) {
|
||||
func TestExplicitClassPointerIsRejected(t *testing.T) {
|
||||
prog, err := Parse(`package demo
|
||||
class Repository
|
||||
fun use(repository: *Repository): *Repository { return repository }`)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out, err := GenerateGo(prog)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if strings.Contains(string(out), "**Repository") || !strings.Contains(string(out), "repository *Repository") {
|
||||
t.Fatalf("unexpected explicit pointer output:\n%s", out)
|
||||
_, err = GenerateGo(prog)
|
||||
if err == nil || !strings.Contains(err.Error(), "already reference-valued") {
|
||||
t.Fatalf("unexpected explicit pointer result: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue