Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper error message #3149

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.kframework.kore.Sort;
import org.kframework.parser.outer.Outer;
import org.kframework.utils.errorsystem.KEMException;
import scala.Option;
import scala.Tuple2;

import java.util.ArrayList;
Expand Down Expand Up @@ -437,11 +438,12 @@ private Production production(KApply term) {
if (term.klabel() instanceof KVariable) {
throw KEMException.internalError("KORE does not yet support KLabel variables.", term);
}
scala.collection.Set<Production> prods = mod.productionsFor().apply(((KApply) term).klabel().head());
if (prods.size() == 0) {
throw KEMException.compilerError("Could not find production for KApply with label " + term.klabel(), term);
Option<scala.collection.Set<Production>> prods = mod.productionsFor().get(term.klabel().head());
if (prods.isEmpty()) {
throw KEMException.compilerError("Could not find productions for KApply with label "
+ term.klabel() + " in module " + mod.name(), term);
}
return prods.head();
return prods.get().head();
}

private static Sort lub(Collection<Sort> entries, Sort expectedSort, HasLocation loc, Module mod) {
Expand Down