Skip to content

Commit

Permalink
adds another testcase and attempts to fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArquintL committed Jun 24, 2024
1 parent 86ea6dc commit 0a86f7e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ trait GhostTyping extends GhostClassifier { this: TypeInfoImpl =>
case sp: ap.Symbolic => sp.symb.ghost
case ap.PointerType(base) => isTypeGhost(base)
}
case _ => Violation.violation(s"expected a type but got $t")
case _ => false
}
}

Expand Down
24 changes: 24 additions & 0 deletions src/test/scala/viper/gobra/erasing/GhostErasureUnitTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,30 @@ class GhostErasureUnitTests extends AnyFunSuite with Matchers with Inside {
frontend.testProg(input, expected)
}

test("Ghost Erasure: ghost types should be erased") {
val input =
s"""
|package pkg
|type Struct struct {
| f int
| ghost g int
|}
|ghost type GhostStruct struct {
| f int
|}
|ghost type GhostIntDef int
|ghost type GhostIntAlias = int
|""".stripMargin
val expected =
s"""
|package pkg
|type Struct struct {
| f int
|}
|""".stripMargin
frontend.testProg(input, expected)
}

/* ** Stubs, mocks, and other test setup */

class TestFrontend {
Expand Down

0 comments on commit 0a86f7e

Please sign in to comment.