Skip to content

Commit

Permalink
merge: Document for Reducible and JitPrim should not implement Reduci…
Browse files Browse the repository at this point in the history
…ble (#1046)
  • Loading branch information
ice1000 authored May 28, 2024
2 parents 3b10dbe + c767b9c commit c92d9e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 6 additions & 0 deletions syntax/src/main/java/org/aya/generic/stmt/Reducible.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@

import kala.collection.Seq;
import org.aya.syntax.core.term.Term;
import org.aya.syntax.core.term.call.Callable;
import org.jetbrains.annotations.NotNull;

/**
* A marker that indicates something can be reduced/has a corresponding {@link Callable}.
* This is used for making serialization safer,
* therefore {@link org.aya.syntax.core.def.FnDef} doesn't implement this marker but {@link org.aya.syntax.compile.JitFn} does.
*/
public interface Reducible {
/**
* @param fallback return this when unable to reduce, it is acceptable that fallback is null.
Expand Down
6 changes: 1 addition & 5 deletions syntax/src/main/java/org/aya/syntax/compile/JitPrim.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@
import org.aya.util.error.Panic;
import org.jetbrains.annotations.NotNull;

public abstract non-sealed class JitPrim extends JitDef implements PrimDefLike, Reducible {
public abstract non-sealed class JitPrim extends JitDef implements PrimDefLike {
public final PrimDef.ID id;
@Override public PrimDef.@NotNull ID id() { return id; }
protected JitPrim(int telescopeSize, boolean[] telescopeLicit, String[] telescopeName, PrimDef.ID id) {
super(telescopeSize, telescopeLicit, telescopeName);
this.id = id;
}

@Override public Term invoke(Term stuck, @NotNull Seq<Term> args) {
throw new Panic("Should not be called");
}
}

0 comments on commit c92d9e3

Please sign in to comment.