Skip to content

Commit

Permalink
Don't check bodies of transactions that are part of interfaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoblenz committed Jan 14, 2020
1 parent 34cc370 commit ad4f35e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/scala/edu/cmu/cs/obsidian/typecheck/Checker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2770,6 +2770,7 @@ class Checker(globalTable: SymbolTable, verbose: Boolean = false) {
}
}

// Checks to make sure that a contract actually implements all the declarations in the interface it claims to implement.
def implementOk(table: ContractTable, contract: Contract, interfaceName: String,
declarations: Seq[Declaration], boundDecls: Seq[Declaration]): Unit = {
var toImplStates = boundDecls.flatMap {
Expand Down Expand Up @@ -2841,6 +2842,8 @@ class Checker(globalTable: SymbolTable, verbose: Boolean = false) {
}
}

var newDecls = obsContract.declarations

if (!obsContract.isInterface) {
val boundDecls = globalTable.contract(obsContract.bound.contractName) match {
case Some(interface) => interface.contract match {
Expand All @@ -2855,12 +2858,10 @@ class Checker(globalTable: SymbolTable, verbose: Boolean = false) {
}

implementOk(table, obsContract, obsContract.bound.contractName, obsContract.declarations, boundDecls)
newDecls = obsContract.declarations.map(checkDeclaration(table))
checkConstructors(table.constructors, obsContract, table)
}

val newDecls = obsContract.declarations.map(checkDeclaration(table))

checkConstructors(table.constructors, obsContract, table)

obsContract.copy(declarations = newDecls)
case ffiContract: JavaFFIContractImpl => ffiContract
}
Expand Down

0 comments on commit ad4f35e

Please sign in to comment.