Skip to content

Commit

Permalink
Inline EAsSet and WAsSet so that IntelliJ stop reporting false error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott-Guest committed Dec 4, 2023
1 parent 431c334 commit 48bee2d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions kore/src/main/scala/org/kframework/parser/Transformer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ abstract class GeneralTransformer[E, W] extends ChildrenMapping[E, W] {
def apply(c: Constant): (Either[E, Term], W) = simpleResult(c)
}

trait EAsSet[E] {
abstract class SetsGeneralTransformer[E, W]
extends GeneralTransformer[java.util.Set[E], java.util.Set[W]] {
/**
* Merges the set of problematic (i.e., Left) results.
*/
Expand All @@ -129,10 +130,9 @@ trait EAsSet[E] {
}

val errorUnit: java.util.Set[E] = new java.util.HashSet[E]()
}

trait WAsSet[W] {
val warningUnit: java.util.Set[W] = new java.util.HashSet[W]()

/**
* Merges the set of problematic (i.e., Left) results.
*/
Expand All @@ -143,9 +143,6 @@ trait WAsSet[W] {
}
}

abstract class SetsGeneralTransformer[E, W]
extends GeneralTransformer[java.util.Set[E], java.util.Set[W]] with EAsSet[E] with WAsSet[W]

/**
* Visitor pattern for the front end classes.
* Applies the visitor transformation on each node, and returns either a term, or a set of errors. (no warnings)
Expand Down Expand Up @@ -185,7 +182,18 @@ abstract class TransformerWithErrors[E] extends ChildrenMapping[E, Ignore] {
}

abstract class SetsTransformerWithErrors[E]
extends TransformerWithErrors[java.util.Set[E]] with EAsSet[E]
extends TransformerWithErrors[java.util.Set[E]] {
/**
* Merges the set of problematic (i.e., Left) results.
*/
def mergeErrors(a: java.util.Set[E], b: java.util.Set[E]): java.util.Set[E] = {
val c = new java.util.HashSet[E](a)
c.addAll(b)
c
}

val errorUnit: java.util.Set[E] = new java.util.HashSet[E]()
}

/**
* Visitor pattern for the front end classes.
Expand Down

0 comments on commit 48bee2d

Please sign in to comment.