forked from KeYProject/key
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for JML
\TYPE
(KeYProject#3465)
- Loading branch information
Showing
19 changed files
with
316 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
key.core/src/main/java/de/uka/ilkd/key/java/expression/operator/Subtype.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* This file is part of KeY - https://key-project.org | ||
* KeY is licensed under the GNU General Public License Version 2 | ||
* SPDX-License-Identifier: GPL-2.0-only */ | ||
package de.uka.ilkd.key.java.expression.operator; | ||
|
||
import de.uka.ilkd.key.java.Expression; | ||
import de.uka.ilkd.key.java.visitor.Visitor; | ||
|
||
import org.key_project.util.ExtList; | ||
|
||
/** | ||
* Subtype | ||
*/ | ||
public class Subtype extends BinaryOperator { | ||
|
||
public Subtype(ExtList children) { | ||
super(children); | ||
} | ||
|
||
public Subtype(Expression lhs, Expression rhs) { | ||
super(lhs, rhs); | ||
} | ||
|
||
|
||
/** | ||
* Get precedence. | ||
* | ||
* @return the int value. | ||
*/ | ||
|
||
public int getPrecedence() { | ||
return 3; | ||
} | ||
|
||
/** | ||
* Get notation. | ||
* | ||
* @return the int value. | ||
*/ | ||
|
||
public int getNotation() { | ||
return INFIX; | ||
} | ||
|
||
/** | ||
* calls the corresponding method of a visitor in order to perform some action/transformation on | ||
* this element | ||
* | ||
* @param v the Visitor | ||
*/ | ||
public void visit(Visitor v) { | ||
v.performActionOnSubtype(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* This file is part of KeY - https://key-project.org | ||
* KeY is licensed under the GNU General Public License Version 2 | ||
* SPDX-License-Identifier: GPL-2.0-only */ | ||
package de.uka.ilkd.key.ldt; | ||
|
||
import de.uka.ilkd.key.java.Expression; | ||
import de.uka.ilkd.key.java.Services; | ||
import de.uka.ilkd.key.java.abstraction.Type; | ||
import de.uka.ilkd.key.java.expression.Literal; | ||
import de.uka.ilkd.key.java.expression.Operator; | ||
import de.uka.ilkd.key.java.expression.operator.Subtype; | ||
import de.uka.ilkd.key.java.reference.ExecutionContext; | ||
import de.uka.ilkd.key.logic.Term; | ||
import de.uka.ilkd.key.logic.TermServices; | ||
import de.uka.ilkd.key.logic.op.JFunction; | ||
import de.uka.ilkd.key.logic.op.SortDependingFunction; | ||
import de.uka.ilkd.key.proof.io.ProofSaver; | ||
|
||
import org.key_project.logic.Name; | ||
import org.key_project.logic.sort.Sort; | ||
import org.key_project.util.ExtList; | ||
|
||
|
||
public final class SortLDT extends LDT { | ||
|
||
public static final Name NAME = new Name("SORT"); | ||
|
||
private final SortDependingFunction ssort; | ||
private final JFunction ssubsort; | ||
|
||
public SortLDT(TermServices services) { | ||
super(NAME, services); | ||
ssort = addSortDependingFunction(services, "ssort"); | ||
ssubsort = addFunction(services, "ssubsort"); | ||
} | ||
|
||
public SortDependingFunction getSsort(Sort instanceSort, TermServices services) { | ||
return ssort.getInstanceFor(instanceSort, services); | ||
} | ||
|
||
public JFunction getSsubsort() { | ||
return ssubsort; | ||
} | ||
|
||
@Override | ||
public boolean isResponsible(Operator op, Term[] subs, Services services, ExecutionContext ec) { | ||
return op instanceof Subtype; | ||
} | ||
|
||
@Override | ||
public boolean isResponsible(Operator op, Term left, Term right, Services services, | ||
ExecutionContext ec) { | ||
return op instanceof Subtype; | ||
} | ||
|
||
@Override | ||
public boolean isResponsible(Operator op, Term sub, TermServices services, | ||
ExecutionContext ec) { | ||
return op instanceof Subtype; | ||
} | ||
|
||
@Override | ||
public Term translateLiteral(Literal lit, Services services) { | ||
assert false; | ||
return null; | ||
} | ||
|
||
@Override | ||
public JFunction getFunctionFor(Operator op, Services services, ExecutionContext ec) { | ||
if (op instanceof Subtype) { | ||
return ssubsort; | ||
} | ||
|
||
assert false; | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean hasLiteralFunction(JFunction f) { | ||
return f instanceof SortDependingFunction sf && sf.isSimilar(ssort); | ||
} | ||
|
||
@Override | ||
public Expression translateTerm(Term t, ExtList children, Services services) { | ||
if (t.op() instanceof SortDependingFunction sf && sf.isSimilar(ssort)) { | ||
// TODO | ||
} | ||
|
||
throw new IllegalArgumentException( | ||
"Could not translate " + ProofSaver.printTerm(t, null) + " to program."); | ||
} | ||
|
||
@Override | ||
public Type getType(Term t) { | ||
assert false; | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
key.core/src/main/resources/de/uka/ilkd/key/java/JavaRedux/java/lang/Object.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,5 @@ | |
map, | ||
freeADT, | ||
wellfound, | ||
charListHeader; | ||
charListHeader, | ||
types; |
Oops, something went wrong.