mbeckerle commented on a change in pull request #259: Incremental progress on
schema compilation space/speed issue.
URL: https://github.com/apache/incubator-daffodil/pull/259#discussion_r303192187
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
##########
@@ -943,155 +964,192 @@ sealed abstract class StepExpression(val step: String,
val pred: Option[Predicat
NodeInfo.ArrayIndex
}
+}
+
+sealed abstract class DownStepExpression(s: String, predArg:
Option[PredicateExpression])
+ extends StepExpression(s, predArg) {
+
+ /**
+ * Since an expresion can be in a reused group, type, or element, the
downward path
+ * step may actually represent a step downward to distinct elements that
happen to
+ * just have the same name/namespace, but they could be different types.
+ *
+ * If that is the case, for the expression to be meaningful, the path step
must be
+ * ultimately result in an element of type suitable for the next operation
that
+ * occurs on the element.
+ *
+ * So the inherent type is the generalization of all the possible element
types.
+ * This is the least-upper-bound on the lattice of types.
+ */
override lazy val inherentType: NodeInfo.Kind = {
- if (!isLastStep) NodeInfo.Complex
- else {
- if (stepElement.optPrimType.isDefined) {
- // simple type, so
- val pt = stepElement.optPrimType.get
- pt
- } else {
- NodeInfo.Complex
- }
+ stepElements.map { _.typeNode }.reduce {
+ (left, right) =>
+ NodeInfoUtils.typeLeastUpperBound(left, right)
}
+ //
Review comment:
remove commented code - this diagnostic behavior is elsewhere now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services