Skip to content

Commit

Permalink
reorganize files
Browse files Browse the repository at this point in the history
  • Loading branch information
jcp19 committed Jan 28, 2025
1 parent a10bb09 commit 6d2a575
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 49 deletions.
7 changes: 3 additions & 4 deletions src/main/scala/viper/gobra/frontend/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import viper.gobra.frontend.info.base.Type._
import viper.gobra.frontend.info.base.{BuiltInMemberTag, Type, SymbolTable => st}
import viper.gobra.frontend.info.implementation.resolution.MemberPath
import viper.gobra.frontend.info.{ExternalTypeInfo, TypeInfo}
import viper.gobra.reporting.Source.{AutoImplProofAnnotation, MainPreNotEstablished}
import viper.gobra.reporting.Source.{AutoImplProofAnnotation, ImportPreNotEstablished, MainPreNotEstablished}
import viper.gobra.reporting.{DesugaredMessage, Source}
import viper.gobra.theory.Addressability
import viper.gobra.translator.Names
Expand Down Expand Up @@ -3466,15 +3466,14 @@ object Desugar extends LazyLogging {

// Check that all import preconditions of imported packages are implied by those packages'
// friend clauses.
val currPkgUniqId = mainPkg.info.uniquePath
val resourcesToPkg = initSpecs.getImportsFromMainPkg()
resourcesToPkg.foreach{ case (pkg, resources) =>
val src = meta(mainPkg, info)
val importObligationsOpt = checkPkgImportObligations(mainPkg, pkg, resources, initSpecs)(src)
val annotatedSrc = src.createAnnotatedInfo(ImportPreNotEstablished)
val importObligationsOpt = checkPkgImportObligations(mainPkg, pkg, resources, initSpecs)(annotatedSrc)
importObligationsOpt.foreach(AdditionalMembers.addMember)
}


// if the main function is present, check its proof obligations
val mainFuncObligations = generateMainFuncProofObligation(mainPkg, initSpecs)
mainFuncObligations.foreach(AdditionalMembers.addMember)
Expand Down
13 changes: 0 additions & 13 deletions src/test/resources/same_package/import-fail01/bar/bar.gobra

This file was deleted.

12 changes: 0 additions & 12 deletions src/test/resources/same_package/import-fail01/importer1.gobra

This file was deleted.

13 changes: 0 additions & 13 deletions src/test/resources/same_package/import-fail01/importer2.gobra

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

initEnsures acc(&A) && acc(&B) && acc(&C)
package bar

// ##(-I ../)

friendPkg "pkg" acc(&A) && acc(&B) && acc(&C)

var A@ int = 1
var B@ int = 2
var C@ int = 3
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

package main
package pkg

// ##(-I ../)

// ##(-I ./)
importRequires acc(&bar.A) && acc(&bar.B)
import "bar"
9 changes: 9 additions & 0 deletions src/test/resources/same_package/import1/pkg/importer2.gobra
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

package pkg

// ##(-I ../)

importRequires acc(&bar.C)
import "bar"
12 changes: 12 additions & 0 deletions src/test/resources/same_package/import2/bar/bar.gobra
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

package bar

// ##(-I ../)

friendPkg "pkg" acc(&A) && acc(&B) && acc(&C)

var A@ int = 1
var B@ int = 2
var C@ int = 3
9 changes: 9 additions & 0 deletions src/test/resources/same_package/import2/pkg/importer1.gobra
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

package pkg

// ##(-I ../)

importRequires acc(&bar.A) && acc(&bar.B)
import "bar"
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

package main
package pkg

// ##(-I ../)

// ##(-I ./)
//:: ExpectedOutput(import_pre_error)
importRequires acc(&bar.B) && acc(&bar.C)
import "bar"
2 changes: 0 additions & 2 deletions src/test/resources/same_package/pkg_init/scion/scion.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
// @ importRequires path.PkgInv()
// @ importRequires path.RegisteredTypes().DoesNotContain(1) &&
// @ path.RegisteredTypes().DoesNotContain(2)
// importRequires false // TODO: check and then drop
// @ "scion/path"
"scion/path/onehop"
"scion/path/scion"
Expand All @@ -33,5 +32,4 @@ import (
func init() {
scion.RegisterPath()
onehop.RegisterPath()
// assert false
}

0 comments on commit 6d2a575

Please sign in to comment.