You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2018/01/16 17:52:41 UTC

[GitHub] mbeckerle closed pull request #23: This fix done for nato-stanag-5516 latest schema.

mbeckerle closed pull request #23: This fix done for nato-stanag-5516 latest schema.
URL: https://github.com/apache/incubator-daffodil/pull/23
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dpath/DFDLExpressionParser.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dpath/DFDLExpressionParser.scala
index 3867074e0..241340d27 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dpath/DFDLExpressionParser.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dpath/DFDLExpressionParser.scala
@@ -37,9 +37,9 @@ import edu.illinois.ncsa.daffodil.dsom._
 import scala.xml.NamespaceBinding
 import edu.illinois.ncsa.daffodil.xml._
 import scala.util.parsing.input.CharSequenceReader
-import edu.illinois.ncsa.daffodil.oolag.ErrorsNotYetRecorded
 import scala.util.parsing.combinator.RegexParsers
 import java.math.{ BigDecimal => JBigDecimal, BigInteger => JBigInt }
+import edu.illinois.ncsa.daffodil.oolag.OOLAG._
 
 /**
  * Parses DPath expressions. Most real analysis is done later. This is
@@ -59,14 +59,11 @@ class DFDLPathExpressionParser[T <: AnyRef](qn: NamedQName,
   nodeInfoKind: NodeInfo.Kind,
   namespaces: NamespaceBinding,
   context: DPathCompileInfo,
-  isEvaluatedAbove: Boolean) extends RegexParsers {
+  isEvaluatedAbove: Boolean,
+  host: OOLAGHost) extends RegexParsers {
 
   def compile(expr: String): CompiledExpression[T] = {
-    val tree = getExpressionTree(expr)
-
-    if (tree.isError) {
-      throw new ErrorsNotYetRecorded(tree.getDiagnostics)
-    }
+    val tree = getExpressionTree(expr, host)
 
     val recipe = tree.compiledDPath // if we cannot get one this will fail by throwing out of here.
 
@@ -131,7 +128,7 @@ class DFDLPathExpressionParser[T <: AnyRef](qn: NamedQName,
       r
     }
 
-  def getExpressionTree(expr: String): WholeExpression = {
+  def getExpressionTree(expr: String, host: OOLAGHost): WholeExpression = {
     // This wrapping of phrase() prevents a memory leak in the scala parser
     // combinators in scala 2.10. See the following bug for more information:
     //
@@ -212,7 +209,7 @@ class DFDLPathExpressionParser[T <: AnyRef](qn: NamedQName,
   //
   // we don't care if it has braces around it or not.
   def TopLevel: Parser[WholeExpression] = ("{" ~> Expr <~ "}" | Expr) ^^ { xpr =>
-    WholeExpression(nodeInfoKind, xpr, namespaces, context)
+    WholeExpression(nodeInfoKind, xpr, namespaces, context, host)
   }
 
   val SuccessAtEnd = Parser { in => Success(in, new CharSequenceReader("")) }
diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dpath/Expression.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dpath/Expression.scala
index a1398b6b3..2d0cb6b74 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dpath/Expression.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dpath/Expression.scala
@@ -576,11 +576,12 @@ case class WholeExpression(
   nodeInfoKind: NodeInfo.Kind,
   ifor: Expression,
   nsBindingForPrefixResolution: NamespaceBinding,
-  ci: DPathCompileInfo)
+  ci: DPathCompileInfo,
+  host: OOLAGHost)
   extends Expression {
 
   def init() {
-    this.setOOLAGContext(null) // we are the root.
+    this.setOOLAGContext(host) // we are the root of expression, but we propagate diagnostics further.
     this.setContextsForChildren()
   }
 
@@ -1102,14 +1103,14 @@ case class NamedStep(s: String, predArg: Option[PredicateExpression])
     val stepElem = if (isFirstStep) {
       if (isAbsolutePath) {
         // has to be the root element, but we have to make sure the name matches.
-        rootElement.findRoot(stepQName)
+        rootElement.findRoot(stepQName, this)
         rootElement
       } else {
         // since we're first we start from the element, or nearest enclosing
         val nc = compileInfo.elementCompileInfo.getOrElse {
           // happens for example if you have defaultValue="false" since false looks like a path step, but is really illegal. should be fn:false().
           compileInfo.SDE("The expression path step '%s' has no defined enclosing element.", s)
-        }.findNamedChild(stepQName)
+        }.findNamedChild(stepQName, this)
         nc
       }
     } else {
@@ -1118,7 +1119,7 @@ case class NamedStep(s: String, predArg: Option[PredicateExpression])
         val psse = ps.stepElement
         psse
       }.map { se =>
-        val nc = se.findNamedChild(stepQName)
+        val nc = se.findNamedChild(stepQName, this)
         nc
       }.getOrElse(die)
       e
diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ChoiceGroup.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ChoiceGroup.scala
index f7916ae3d..14b8011ad 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ChoiceGroup.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ChoiceGroup.scala
@@ -144,7 +144,7 @@ abstract class ChoiceTermBase( final override val xml: Node,
     val qn = this.qNameForProperty("choiceDispatchKey")
     val typeIfStaticallyKnown = NodeInfo.NonEmptyString
     val typeIfRuntimeKnown = NodeInfo.NonEmptyString
-    ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, choiceDispatchKeyRaw)
+    ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, choiceDispatchKeyRaw, this)
   }
 
   final lazy val choiceDispatchKeyEv = {
diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/CompiledExpression.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/CompiledExpression.scala
index 7513a6ce3..25e5a4515 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/CompiledExpression.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/CompiledExpression.scala
@@ -37,6 +37,7 @@ import scala.xml.NamespaceBinding
 import edu.illinois.ncsa.daffodil.xml.NamedQName
 import java.lang.{ Long => JLong, Boolean => JBoolean }
 import edu.illinois.ncsa.daffodil.schema.annotation.props.Found
+import edu.illinois.ncsa.daffodil.oolag.OOLAG._
 
 object ExpressionCompilers extends ExpressionCompilerClass {
   override val String = new ExpressionCompiler[String]
@@ -64,8 +65,8 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
   /*
    * This form for most properties
    */
-  def compile(qn: NamedQName, nodeInfoKind: NodeInfo.Kind, property: Found, isEvaluatedAbove: Boolean = false): CompiledExpression[T] =
-    compile(qn, nodeInfoKind, nodeInfoKind, property, isEvaluatedAbove)
+  def compile(qn: NamedQName, nodeInfoKind: NodeInfo.Kind, property: Found, host: OOLAGHost, isEvaluatedAbove: Boolean = false): CompiledExpression[T] =
+    compile(qn, nodeInfoKind, nodeInfoKind, property, isEvaluatedAbove, host)
 
   /*
      * This form for delimiters and escapeEscapeCharacter since they
@@ -82,11 +83,12 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
      * We don't want to allow turning on/off whether a format is delimited or
      * not based on runtime expressions, only what the delimiters are.
      */
-  def compile(qn: NamedQName, staticNodeInfoKind: NodeInfo.Kind, runtimeNodeInfoKind: NodeInfo.Kind, property: Found): CompiledExpression[T] =
-    compile(qn, staticNodeInfoKind, runtimeNodeInfoKind, property, false)
+  def compile(qn: NamedQName, staticNodeInfoKind: NodeInfo.Kind, runtimeNodeInfoKind: NodeInfo.Kind, property: Found,
+    host: OOLAGHost): CompiledExpression[T] =
+    compile(qn, staticNodeInfoKind, runtimeNodeInfoKind, property, false, host)
 
   private def compile(qn: NamedQName, staticNodeInfoKind: NodeInfo.Kind, runtimeNodeInfoKind: NodeInfo.Kind,
-    property: Found, isEvaluatedAbove: Boolean): CompiledExpression[T] = {
+    property: Found, isEvaluatedAbove: Boolean, host: OOLAGHost): CompiledExpression[T] = {
     val expr: String = property.value
     val namespacesForNamespaceResolution = property.location.namespaces
     val compileInfoWherePropertyWasLocated = {
@@ -96,7 +98,7 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
       }
     }
 
-    compile(qn, staticNodeInfoKind, runtimeNodeInfoKind, expr, namespacesForNamespaceResolution, compileInfoWherePropertyWasLocated, isEvaluatedAbove)
+    compile(qn, staticNodeInfoKind, runtimeNodeInfoKind, expr, namespacesForNamespaceResolution, compileInfoWherePropertyWasLocated, isEvaluatedAbove, host)
   }
 
   /**
@@ -108,9 +110,10 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
     expr: String,
     namespaces: NamespaceBinding,
     compileInfoWherePropertyWasLocated: DPathCompileInfo,
-    isEvaluatedAbove: Boolean): CompiledExpression[T] = {
+    isEvaluatedAbove: Boolean,
+    host: OOLAGHost): CompiledExpression[T] = {
     val compiled1 = compile(qn, staticNodeInfoKind, expr, namespaces, compileInfoWherePropertyWasLocated,
-      isEvaluatedAbove)
+      isEvaluatedAbove, host)
     if (compiled1.isConstant) return compiled1
     if (staticNodeInfoKind == runtimeNodeInfoKind) return compiled1
     //
@@ -120,7 +123,7 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
     // This is, this nodeInfo.Kind is used as the target type in the DPath expression compiler, and
     //
     val compiled2 = compile(qn, runtimeNodeInfoKind, expr, namespaces, compileInfoWherePropertyWasLocated,
-      isEvaluatedAbove)
+      isEvaluatedAbove, host)
     compiled2
   }
 
@@ -134,7 +137,7 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
    */
   def compile(qn: NamedQName, nodeInfoKind: NodeInfo.Kind, exprWithBracesMaybe: String, namespaces: NamespaceBinding,
     compileInfoWherePropertyWasLocated: DPathCompileInfo,
-    isEvaluatedAbove: Boolean) = {
+    isEvaluatedAbove: Boolean, host: OOLAGHost) = {
     var compile: Boolean = true
     val expr = exprWithBracesMaybe
     //
@@ -163,8 +166,8 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
       }
     // If we get here then now it's something we can compile. It might be trivial
     // to compile (e.g, '5' compiles to Literal(5)) but we no longer uniformly
-    // compile everything.  Due to the performance optimization (DFDL-1775), 
-    // we will NOT compile constant strings (constant values whose target type 
+    // compile everything.  Due to the performance optimization (DFDL-1775),
+    // we will NOT compile constant strings (constant values whose target type
     // is String).
 
     /* Question: If something starts with {{, e.g.
@@ -183,7 +186,7 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
      */
     val res = if (compile) {
       compileExpression(qn, nodeInfoKind, exprForCompiling, namespaces,
-        compileInfoWherePropertyWasLocated, isEvaluatedAbove)
+        compileInfoWherePropertyWasLocated, isEvaluatedAbove, host)
     } else {
       // Don't compile, meaning this is a constant string
       val res = new ConstantExpression[T](qn, nodeInfoKind, exprForCompiling.asInstanceOf[T])
@@ -208,14 +211,15 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
     // next argument provides? Ans: Point of use versus point of definition.
     namespaces: NamespaceBinding,
     compileInfoWherePropertyWasLocated: DPathCompileInfo,
-    isEvaluatedAbove: Boolean): CompiledExpression[T] = {
+    isEvaluatedAbove: Boolean,
+    host: OOLAGHost): CompiledExpression[T] = {
     // This is important. The namespace bindings we use must be
     // those from the object where the property carrying the expression
     // was written, not those of the edecl object where the property
     // value is being used/compiled. JIRA DFDL-407
     //
     val compiler = new DFDLPathExpressionParser[T](qn,
-      nodeInfoKind, namespaces, compileInfoWherePropertyWasLocated, isEvaluatedAbove)
+      nodeInfoKind, namespaces, compileInfoWherePropertyWasLocated, isEvaluatedAbove, host)
     val compiledDPath = compiler.compile(expr)
     compiledDPath
   }
diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/DFDLDefineVariable.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/DFDLDefineVariable.scala
index cdbcf4af9..497cb78e6 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/DFDLDefineVariable.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/DFDLDefineVariable.scala
@@ -88,7 +88,7 @@ class DFDLDefineVariable(node: Node, doc: SchemaDocument)
     val compilationTargetType = primType
     val qn = this.qNameForProperty("defaultValue", XMLUtils.dafintURI)
     val defaultValExpr = defaultValue.map { e =>
-      ExpressionCompilers.AnyRef.compile(qn, compilationTargetType, Found(e, this.dpathCompileInfo, "defaultValue", false))
+      ExpressionCompilers.AnyRef.compile(qn, compilationTargetType, Found(e, this.dpathCompileInfo, "defaultValue", false), this)
     }
 
     Maybe.toMaybe(defaultValExpr)
@@ -109,7 +109,7 @@ class DFDLDefineVariable(node: Node, doc: SchemaDocument)
 
 abstract class VariableReference(node: Node, decl: AnnotatedSchemaComponent)
   extends DFDLStatement(node, decl) {
-  
+
   final lazy val ref = getAttributeRequired("ref")
   final lazy val varQName = resolveQName(ref)
 
diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/DFDLEscapeScheme.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/DFDLEscapeScheme.scala
index ab68d774b..a2ee6b2b8 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/DFDLEscapeScheme.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/DFDLEscapeScheme.scala
@@ -85,7 +85,7 @@ final class DFDLEscapeScheme(node: Node, decl: AnnotatedSchemaComponent, defES:
 
   final def escapeCharacterEv = LV('escapeCharacterEv) {
     val qn = this.qNameForProperty("escapeCharacter")
-    val expr = ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, escapeCharacterRaw)
+    val expr = ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, escapeCharacterRaw, this)
     val ev = new EscapeCharEv(expr, runtimeData)
     ev.compile()
     ev
@@ -98,7 +98,7 @@ final class DFDLEscapeScheme(node: Node, decl: AnnotatedSchemaComponent, defES:
       case found @ Found(v, loc, _, _) => {
         val typeIfStaticallyKnown = NodeInfo.String
         val typeIfRuntimeKnown = NodeInfo.NonEmptyString
-        val expr = ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, found)
+        val expr = ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, found, this)
         val ev = new EscapeEscapeCharEv(expr, runtimeData)
         ev.compile()
         One(ev)
diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/RuntimePropertyMixins.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/RuntimePropertyMixins.scala
index 984b22ad7..3f9f6bf1a 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/RuntimePropertyMixins.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/RuntimePropertyMixins.scala
@@ -108,7 +108,7 @@ trait TermRuntimeValuedPropertiesMixin
         val exp = ConstantExpression(qn, PrimType.HexBinary, "iso-8859-1")
         exp
       }
-      case _ => ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, encodingRaw)
+      case _ => ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, encodingRaw, decl)
     }
   }.value
 
@@ -154,7 +154,7 @@ trait TermRuntimeValuedPropertiesMixin
   lazy val outputNewLineEv = {
     val outputNewLineExpr = {
       val qn = this.qNameForProperty("outputNewLine")
-      ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, outputNewLineRaw)
+      ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, outputNewLineRaw, decl)
     }
     val ev = new OutputNewLineEv(outputNewLineExpr, termRuntimeData)
     ev.compile()
@@ -203,7 +203,7 @@ trait DelimitedRuntimeValuedPropertiesMixin
     val qn = this.qNameForProperty("initiator")
     val typeIfStaticallyKnown = NodeInfo.String
     val typeIfRuntimeKnown = NodeInfo.NonEmptyString
-    ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, initiatorRaw)
+    ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, initiatorRaw, decl)
   }
 
   lazy val initiatorParseEv = {
@@ -224,7 +224,7 @@ trait DelimitedRuntimeValuedPropertiesMixin
     val typeIfStaticallyKnown = NodeInfo.String
     val typeIfRuntimeKnown = NodeInfo.NonEmptyString
     val raw = terminatorRaw
-    ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, raw)
+    ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, raw, decl)
   }.value
 
   final def terminatorLoc = (this.diagnosticDebugName, this.path)
@@ -258,7 +258,7 @@ trait ElementRuntimeValuedPropertiesMixin
 
   private lazy val byteOrderExpr = LV('byteOrder) {
     val qn = this.qNameForProperty("byteOrder")
-    ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, byteOrderRaw)
+    ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, byteOrderRaw, decl)
   }.value
 
   final lazy val byteOrderEv = {
@@ -278,7 +278,7 @@ trait ElementRuntimeValuedPropertiesMixin
 
   protected final lazy val lengthExpr = {
     val qn = this.qNameForProperty("length")
-    ExpressionCompilers.JLong.compile(qn, NodeInfo.Long, lengthRaw)
+    ExpressionCompilers.JLong.compile(qn, NodeInfo.Long, lengthRaw, decl)
   }
 
   private lazy val explicitLengthEv: ExplicitLengthEv = {
@@ -467,7 +467,7 @@ trait ElementRuntimeValuedPropertiesMixin
   private lazy val occursCountExpr = LV('occursCount) {
     val qn = this.qNameForProperty("occursCount")
     val isEvaluatedAbove = true
-    ExpressionCompilers.JLong.compile(qn, NodeInfo.Long, occursCountRaw, isEvaluatedAbove)
+    ExpressionCompilers.JLong.compile(qn, NodeInfo.Long, occursCountRaw, decl, isEvaluatedAbove)
   }.value
 
   lazy val occursCountEv = {
@@ -550,7 +550,7 @@ trait SequenceRuntimeValuedPropertiesMixin
     val qn = this.qNameForProperty("separator")
     val typeIfStaticallyKnown = NodeInfo.String
     val typeIfRuntimeKnown = NodeInfo.NonEmptyString
-    ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, separatorRaw)
+    ExpressionCompilers.String.compile(qn, typeIfStaticallyKnown, typeIfRuntimeKnown, separatorRaw, decl)
   }
 
   lazy val separatorParseEv = {
@@ -588,7 +588,7 @@ trait SimpleTypeRuntimeValuedPropertiesMixin
 
   private lazy val textStandardDecimalSeparatorExpr = LV('textStandardDecimalSeparator) {
     val qn = this.qNameForProperty("textStandardDecimalSeparator")
-    val c = ExpressionCompilers.String.compile(qn, NodeInfo.String, textStandardDecimalSeparatorRaw)
+    val c = ExpressionCompilers.String.compile(qn, NodeInfo.String, textStandardDecimalSeparatorRaw, decl)
     c
   }.value
 
@@ -600,7 +600,7 @@ trait SimpleTypeRuntimeValuedPropertiesMixin
 
   private lazy val textStandardGroupingSeparatorExpr = LV('textStandardGroupingSeparator) {
     val qn = this.qNameForProperty("textStandardGroupingSeparator")
-    val c = ExpressionCompilers.String.compile(qn, NodeInfo.String, textStandardGroupingSeparatorRaw)
+    val c = ExpressionCompilers.String.compile(qn, NodeInfo.String, textStandardGroupingSeparatorRaw, decl)
     c
   }.value
 
@@ -612,7 +612,7 @@ trait SimpleTypeRuntimeValuedPropertiesMixin
 
   private lazy val textStandardExponentRepExpr = LV('textStandardExponentRep) {
     val qn = this.qNameForProperty("textStandardExponentRep")
-    val c = ExpressionCompilers.String.compile(qn, NodeInfo.String, textStandardExponentRepRaw)
+    val c = ExpressionCompilers.String.compile(qn, NodeInfo.String, textStandardExponentRepRaw, decl)
     c
   }.value
 
@@ -624,7 +624,7 @@ trait SimpleTypeRuntimeValuedPropertiesMixin
 
   private lazy val binaryFloatRepExpr = LV('binaryFloatRep) {
     val qn = this.qNameForProperty("binaryFloatRep")
-    ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, binaryFloatRepRaw)
+    ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, binaryFloatRepRaw, decl)
   }.value
 
   final lazy val binaryFloatRepEv = {
@@ -644,12 +644,12 @@ trait SimpleTypeRuntimeValuedPropertiesMixin
 
   private lazy val textBooleanTrueRepExpr = LV('textBooleanTrueRep) {
     val qn = this.qNameForProperty("textBooleanTrueRep")
-    ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, textBooleanTrueRepRaw)
+    ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, textBooleanTrueRepRaw, decl)
   }.value
 
   private lazy val textBooleanFalseRepExpr = LV('textBooleanFalseRep) {
     val qn = this.qNameForProperty("textBooleanFalseRep")
-    ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, textBooleanFalseRepRaw)
+    ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, textBooleanFalseRepRaw, decl)
   }.value
 
   final lazy val textBooleanTrueRepEv = {
@@ -668,7 +668,7 @@ trait SimpleTypeRuntimeValuedPropertiesMixin
 
   final lazy val calendarLanguage = LV('calendarLanguage) {
     val qn = this.qNameForProperty("calendarLanguage")
-    val c = ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, calendarLanguageRaw)
+    val c = ExpressionCompilers.String.compile(qn, NodeInfo.NonEmptyString, calendarLanguageRaw, decl)
     c
   }.value
 }
diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/ElementBaseGrammarMixin.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/ElementBaseGrammarMixin.scala
index 5172c2f53..b6abd45f3 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/ElementBaseGrammarMixin.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/ElementBaseGrammarMixin.scala
@@ -1061,7 +1061,7 @@ trait ElementBaseGrammarMixin
     val exprNamespaces = exprProp.location.namespaces
     val qn = GlobalQName(Some("daf"), "outputValueCalc", XMLUtils.dafintURI)
     val expr = ExpressionCompilers.AnyRef.compile(qn,
-      primType, exprText, exprNamespaces, dpathCompileInfo, false)
+      primType, exprText, exprNamespaces, dpathCompileInfo, false, self)
     expr
   }
 
diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/primitives/PrimitivesExpressions.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/primitives/PrimitivesExpressions.scala
index db992a5a6..c16ddb93f 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/primitives/PrimitivesExpressions.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/primitives/PrimitivesExpressions.scala
@@ -183,7 +183,7 @@ abstract class ExpressionEvaluatorBase(e: AnnotatedSchemaComponent) extends Term
 
   lazy val expr = LV('expr) {
     ExpressionCompilers.AnyRef.compile(qn,
-      nodeKind, exprText, exprNamespaces, exprComponent.dpathCompileInfo, false)
+      nodeKind, exprText, exprNamespaces, exprComponent.dpathCompileInfo, false, this)
   }.value
 }
 
diff --git a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dpath/TestDFDLExpressionEvaluation.scala b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dpath/TestDFDLExpressionEvaluation.scala
index 9cf2459ad..75ac045cd 100644
--- a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dpath/TestDFDLExpressionEvaluation.scala
+++ b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dpath/TestDFDLExpressionEvaluation.scala
@@ -62,7 +62,7 @@ class TestDFDLExpressionEvaluation extends Parsers {
     val erd = decl.elementRuntimeData
     val infosetRootElem = TestInfoset.elem2Infoset(erd, infosetAsXML)
     val qn = GlobalQName(Some("daf"), "testExpr", XMLUtils.dafintURI)
-    val exprCompiler = new DFDLPathExpressionParser[AnyRef](qn, NodeInfo.AnyType, testSchema.scope, erd.dpathCompileInfo, false)
+    val exprCompiler = new DFDLPathExpressionParser[AnyRef](qn, NodeInfo.AnyType, testSchema.scope, erd.dpathCompileInfo, false, sset)
     val compiledExpr = exprCompiler.compile(expr)
     val doc = infosetRootElem.parent.asInstanceOf[DIDocument]
 
diff --git a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dpath/TestDFDLExpressionTree.scala b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dpath/TestDFDLExpressionTree.scala
index 957a523c2..3f79e179a 100644
--- a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dpath/TestDFDLExpressionTree.scala
+++ b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dpath/TestDFDLExpressionTree.scala
@@ -60,8 +60,8 @@ class TestDFDLExpressionTree extends Parsers {
     val decl = declf.forRoot()
     val erd = decl.elementRuntimeData
 
-    val exprCompiler = new DFDLPathExpressionParser(qn, NodeInfo.String, testSchema.scope, erd.dpathCompileInfo, false)
-    val result = exprCompiler.getExpressionTree(expr)
+    val exprCompiler = new DFDLPathExpressionParser(qn, NodeInfo.String, testSchema.scope, erd.dpathCompileInfo, false, sset)
+    val result = exprCompiler.getExpressionTree(expr, sset)
     body(result)
   }
 
@@ -73,8 +73,8 @@ class TestDFDLExpressionTree extends Parsers {
     val Seq(declf) = schemaDoc.globalElementDecls
     val decl = declf.forRoot()
     val erd = decl
-    val exprCompiler = new DFDLPathExpressionParser(qn, NodeInfo.AnyType, testSchema.scope, decl.dpathCompileInfo, false)
-    val result = exprCompiler.getExpressionTree(expr)
+    val exprCompiler = new DFDLPathExpressionParser(qn, NodeInfo.AnyType, testSchema.scope, decl.dpathCompileInfo, false, sset)
+    val result = exprCompiler.getExpressionTree(expr, sset)
     body(result, erd.elementRuntimeData)
   }
 
@@ -100,7 +100,7 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def test_a() = {
     testExpr2(aSchema, "{ /tns:a }") { (ce, erd) =>
-      val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _) = ce
+      val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _, _) = ce
       val List(n1) = steps
       val n1p @ NamedStep("tns:a", None) = n1; assertNotNull(n1p)
       assertFalse(n1.isArray)
@@ -125,7 +125,7 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def test_a_pred() {
     testExpr2(bSchema, "{ /tns:b/a[/tns:b/i] }") { (ce, erd) =>
-      val w @ WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _) = ce
+      val w @ WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _, _) = ce
       val List(b, a) = steps
       val bp @ NamedStep("tns:b", None) = b; assertNotNull(bp)
       val NamedStep("a", Some(PredicateExpression(i))) = a
@@ -141,7 +141,7 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def test_a_predPred() {
     testExpr(dummySchema, "{ a[i[j]] }") { actual =>
-      val WholeExpression(_, RelativePathExpression(steps, _), _, _) = actual
+      val WholeExpression(_, RelativePathExpression(steps, _), _, _, _) = actual
       val List(n1) = steps
       val NamedStep("a", Some(PredicateExpression(rel))) = n1
       val RelativePathExpression(List(n2), _) = rel
@@ -153,7 +153,7 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def test_relativePath() = {
     testExpr(dummySchema, "{ ../..[2]/bookstore }") { actual =>
-      val WholeExpression(_, RelativePathExpression(steps, _), _, _) = actual
+      val WholeExpression(_, RelativePathExpression(steps, _), _, _, _) = actual
       val List(n1, n2, n3) = steps
       val u @ Up(None) = n1; assertNotNull(u)
       val u2 @ Up(Some(PredicateExpression(LiteralExpression(two: JBigInt)))) = n2; assertNotNull(u2)
@@ -183,7 +183,7 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def test_absolutePath() = {
     testExpr2(testSchema, "{ /tns:bookstore/book/title }") { (actual, erd) =>
-      val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _) = actual
+      val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _, _) = actual
       val List(n1, n2, n3) = steps
       val n1p @ NamedStep("tns:bookstore", None) = n1; assertNotNull(n1p)
       assertTrue(n1.isFirstStep)
@@ -226,7 +226,7 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def test_pathNoSuchElement1() {
     testExpr2(testSchema, "{ /thereIsNoElementWithThisName }") { (actual, erd) =>
-      val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(List(step), _))), _, _) = actual
+      val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(List(step), _))), _, _, _) = actual
       val exc = intercept[SchemaDefinitionError] {
         step.stepElement
       }
@@ -240,7 +240,7 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def test_predPath() = {
     testExpr(dummySchema, "{ /bookstore[$i]/book/title }") { actual =>
-      val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _) = actual
+      val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _, _) = actual
       val List(n1, n2, n3) = steps
       val NamedStep("bookstore", pred) = n1
       // println(pred)
@@ -253,7 +253,7 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def testAddConstants() {
     testExpr(dummySchema, "{ 1 + 2 }") { actual =>
-      val a @ WholeExpression(_, AdditiveExpression("+", List(LiteralExpression(one: JBigInt), LiteralExpression(two: JBigInt))), _, _) = actual; assertNotNull(a)
+      val a @ WholeExpression(_, AdditiveExpression("+", List(LiteralExpression(one: JBigInt), LiteralExpression(two: JBigInt))), _, _, _) = actual; assertNotNull(a)
       assertEquals(BigDecimal(1), BigDecimal(one))
       assertEquals(BigDecimal(2), BigDecimal(two))
     }
@@ -261,14 +261,14 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def testFnTrue() {
     testExpr(dummySchema, "{ fn:true() }") { actual =>
-      val a @ WholeExpression(_, FunctionCallExpression("fn:true", Nil), _, _) = actual; assertNotNull(a)
+      val a @ WholeExpression(_, FunctionCallExpression("fn:true", Nil), _, _, _) = actual; assertNotNull(a)
     }
   }
 
   @Test def test_numbers1() = {
     testExpr(dummySchema, "0.") { actual: Expression =>
       val res = BigDecimal("0.0")
-      val a @ WholeExpression(_, LiteralExpression(actualRes), _, _) = actual; assertNotNull(a)
+      val a @ WholeExpression(_, LiteralExpression(actualRes), _, _, _) = actual; assertNotNull(a)
       val bd = BigDecimal(actualRes.asInstanceOf[JBigDecimal])
       assertEquals(res, bd)
     }
@@ -276,34 +276,34 @@ class TestDFDLExpressionTree extends Parsers {
 
   @Test def test_numbers() = {
 
-    testExpr(dummySchema, "5.0E2") { case WholeExpression(_, LiteralExpression(500.0), _, _) => /* ok */ ; }
-    testExpr(dummySchema, "5E2") { case WholeExpression(_, LiteralExpression(500.0), _, _) => /* ok */ ; }
-    testExpr(dummySchema, ".2E2") { case WholeExpression(_, LiteralExpression(20.0), _, _) => /* ok */ ; }
-    testExpr(dummySchema, ".2E-3") { case WholeExpression(_, LiteralExpression(0.0002), _, _) => /* ok */ ; }
-    testExpr(dummySchema, ".2E+3") { case WholeExpression(_, LiteralExpression(200.0), _, _) => /* ok */ ; }
+    testExpr(dummySchema, "5.0E2") { case WholeExpression(_, LiteralExpression(500.0), _, _, _) => /* ok */ ; }
+    testExpr(dummySchema, "5E2") { case WholeExpression(_, LiteralExpression(500.0), _, _, _) => /* ok */ ; }
+    testExpr(dummySchema, ".2E2") { case WholeExpression(_, LiteralExpression(20.0), _, _, _) => /* ok */ ; }
+    testExpr(dummySchema, ".2E-3") { case WholeExpression(_, LiteralExpression(0.0002), _, _, _) => /* ok */ ; }
+    testExpr(dummySchema, ".2E+3") { case WholeExpression(_, LiteralExpression(200.0), _, _, _) => /* ok */ ; }
 
     //    testExpr(dummySchema, "0.") { actual =>
     //      val res = new JBigDecimal("0.0")
-    //      val a @ WholeExpression(_, LiteralExpression(`res`), _, _) = actual; assertNotNull(a)
+    //      val a @ WholeExpression(_, LiteralExpression(`res`), _, _, _) = actual; assertNotNull(a)
     //    }
     testExpr(dummySchema, ".1") { actual =>
       val res = new JBigDecimal("0.1")
-      val a @ WholeExpression(_, LiteralExpression(`res`), _, _) = actual; assertNotNull(a)
+      val a @ WholeExpression(_, LiteralExpression(`res`), _, _, _) = actual; assertNotNull(a)
     }
     testExpr(dummySchema, "982304892038409234982304892038409234.0909808908982304892038409234") { actual =>
       val res = new JBigDecimal("982304892038409234982304892038409234.0909808908982304892038409234")
-      val WholeExpression(_, LiteralExpression(r: JBigDecimal), _, _) = actual
+      val WholeExpression(_, LiteralExpression(r: JBigDecimal), _, _, _) = actual
       assertEquals(res, r)
     }
 
     testExpr(dummySchema, "0") { actual =>
       val res = scala.math.BigInt(0)
-      val a @ WholeExpression(_, LiteralExpression(actualRes: JBigInt), _, _) = actual; assertNotNull(a)
+      val a @ WholeExpression(_, LiteralExpression(actualRes: JBigInt), _, _, _) = actual; assertNotNull(a)
       assertEquals(res, BigInt(actualRes))
     }
     testExpr(dummySchema, "9817239872193792873982173948739879128370982398723897921370") { actual =>
       val res = scala.math.BigInt("9817239872193792873982173948739879128370982398723897921370")
-      val a @ WholeExpression(_, LiteralExpression(actualRes: JBigInt), _, _) = actual; assertNotNull(a)
+      val a @ WholeExpression(_, LiteralExpression(actualRes: JBigInt), _, _, _) = actual; assertNotNull(a)
       assertEquals(res, BigInt(actualRes))
     }
 
@@ -313,7 +313,7 @@ class TestDFDLExpressionTree extends Parsers {
 
     def testStringLit(expr: String) {
       testExpr(dummySchema, expr) {
-        case WholeExpression(_, LiteralExpression(expr), _, _) => /* ok */
+        case WholeExpression(_, LiteralExpression(expr), _, _, _) => /* ok */
       }
     }
     testStringLit("'abc'")
@@ -334,7 +334,7 @@ class TestDFDLExpressionTree extends Parsers {
 
     def testFn(expr: String)(body: FunctionCallExpression => Unit) {
       testExpr(dummySchema, expr) { actual =>
-        val WholeExpression(_, fnExpr: FunctionCallExpression, _, _) = actual
+        val WholeExpression(_, fnExpr: FunctionCallExpression, _, _, _) = actual
         body(fnExpr)
       }
     }
@@ -352,7 +352,7 @@ class TestDFDLExpressionTree extends Parsers {
     else -h
   else +i
         }""") { actual =>
-      val WholeExpression(_, IfExpression(Seq(pred, thenPart, elsePart)), _, _) = actual
+      val WholeExpression(_, IfExpression(Seq(pred, thenPart, elsePart)), _, _, _) = actual
       val p @ OrExpression(
         List(RelativePathExpression(List(NamedStep("a", None)), _),
           AndExpression(
diff --git a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/debugger/InteractiveDebugger.scala b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/debugger/InteractiveDebugger.scala
index b75f39616..9e496df3b 100644
--- a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/debugger/InteractiveDebugger.scala
+++ b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/debugger/InteractiveDebugger.scala
@@ -64,6 +64,7 @@ import edu.illinois.ncsa.daffodil.infoset.InfosetItem
 import edu.illinois.ncsa.daffodil.infoset.InfosetElement
 import edu.illinois.ncsa.daffodil.infoset.XMLTextInfosetOutputter
 import edu.illinois.ncsa.daffodil.processors.parsers.ConvertTextCombinatorParser
+import edu.illinois.ncsa.daffodil.oolag.OOLAG._
 
 abstract class InteractiveDebuggerRunner {
   def init(id: InteractiveDebugger): Unit
@@ -312,8 +313,15 @@ class InteractiveDebugger(runner: InteractiveDebuggerRunner, eCompilers: Express
       // compile the expression
       //
       val compiledExpr = try {
-        eCompilers.JBoolean.compile(debuggerQName,
-          NodeInfo.Boolean, expression, processor.context.namespaces, context.dpathCompileInfo, false)
+        val hostForDiags = new DebuggerHost()
+        val ce = eCompilers.JBoolean.compile(debuggerQName,
+          NodeInfo.Boolean, expression, processor.context.namespaces, context.dpathCompileInfo, false,
+          hostForDiags)
+        val warnings = hostForDiags.getDiagnostics.filterNot(_.isError)
+        warnings.foreach {
+          debugPrintln(_)
+        }
+        ce
       } catch {
         //
         // These are compile-time errors for the expression compilation
@@ -1046,10 +1054,15 @@ class InteractiveDebugger(runner: InteractiveDebuggerRunner, eCompilers: Express
           else adjustedExpression
         val isEvaluatedAbove = false
         try {
+          val hostForDiags = new DebuggerHost()
           val compiledExpression = eCompilers.AnyRef.compile(debuggerQName,
             NodeInfo.AnyType, expressionWithBraces, namespaces, context.dpathCompileInfo,
-            isEvaluatedAbove)
+            isEvaluatedAbove, hostForDiags)
           val res = compiledExpression.evaluate(state)
+          val warnings = hostForDiags.getDiagnostics.filterNot(_.isError)
+          warnings.foreach {
+            debugPrintln(_)
+          }
           res match {
             case ie: InfosetElement => debugPrettyPrintXML(ie)
             case nodeSeq: Seq[Any] => nodeSeq.foreach { a =>
@@ -1805,3 +1818,9 @@ class InteractiveDebugger(runner: InteractiveDebuggerRunner, eCompilers: Express
     }
   }
 }
+
+/**
+ * A stub OOLAGHost is needed to accumulate warnings that may be created
+ * during expression compilation in the debugger.
+ */
+class DebuggerHost extends OOLAGHostImpl(null) // null means this is the root OOLAG Host
diff --git a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dpath/DPath.scala b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dpath/DPath.scala
index 65be97132..f435aa57b 100644
--- a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dpath/DPath.scala
+++ b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dpath/DPath.scala
@@ -60,11 +60,11 @@ class ExpressionEvaluationException(e: Throwable, s: ParseOrUnparseState)
 // Misc.getSomeMessage(e).get
 
 final class RuntimeExpressionDPath[T <: AnyRef](qn: NamedQName, tt: NodeInfo.Kind, recipe: CompiledDPath,
-                                                dpathText: String,
-                                                ci: DPathCompileInfo,
-                                                isEvaluatedAbove: Boolean,
-                                                override val contentReferencedElementInfos: Set[DPathElementCompileInfo],
-                                                override val valueReferencedElementInfos: Set[DPathElementCompileInfo])
+  dpathText: String,
+  ci: DPathCompileInfo,
+  isEvaluatedAbove: Boolean,
+  override val contentReferencedElementInfos: Set[DPathElementCompileInfo],
+  override val valueReferencedElementInfos: Set[DPathElementCompileInfo])
   extends CompiledExpression[T](qn, dpathText) with DoSDEMixin {
 
   override def targetType = tt
diff --git a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dsom/CompiledExpression1.scala b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dsom/CompiledExpression1.scala
index cd24bcfbb..cf7bef5de 100644
--- a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dsom/CompiledExpression1.scala
+++ b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dsom/CompiledExpression1.scala
@@ -352,13 +352,16 @@ class DPathElementCompileInfo(
    * Finds a child ERD that matches a StepQName. This is for matching up
    * path steps (for example) to their corresponding ERD.
    */
-  final def findNamedChild(step: StepQName): DPathElementCompileInfo =
-    findNamedMatch(step, elementChildrenCompileInfo)
+  final def findNamedChild(step: StepQName,
+    expr: ImplementsThrowsOrSavesSDE): DPathElementCompileInfo =
+    findNamedMatch(step, elementChildrenCompileInfo, expr)
 
-  final def findRoot(step: StepQName): DPathElementCompileInfo =
-    findNamedMatch(step, Seq(this))
+  final def findRoot(step: StepQName,
+    expr: ImplementsThrowsOrSavesSDE): DPathElementCompileInfo =
+    findNamedMatch(step, Seq(this), expr)
 
-  private def findNamedMatch(step: StepQName, possibles: Seq[DPathElementCompileInfo]): DPathElementCompileInfo = {
+  private def findNamedMatch(step: StepQName, possibles: Seq[DPathElementCompileInfo],
+    expr: ImplementsThrowsOrSavesSDE): DPathElementCompileInfo = {
     val matchesERD: Seq[DPathElementCompileInfo] = step.findMatches(possibles)
 
     val retryMatchesERD =
@@ -377,10 +380,46 @@ class DPathElementCompileInfo(
     retryMatchesERD.length match {
       case 0 => noMatchError(step, possibles)
       case 1 => retryMatchesERD(0)
-      case _ => queryMatchError(step, matchesERD)
+      case _ => {
+        queryMatchWarning(step, retryMatchesERD, expr)
+        retryMatchesERD(0)
+      }
     }
   }
 
+  /**
+   * Returns a subset of the possibles which are truly ambiguous siblings.
+   * Does not find all such, but if any exist, it finds some ambiguous
+   * Siblings. Only returns empty Seq if there are no ambiguous siblings.
+   */
+  //      private def ambiguousModelGroupSiblings(possibles: Seq[DPathElementCompileInfo]) : Seq[DPathElementCompileInfo] = {
+  //        val ambiguityLists: Seq[Seq[DPathElementCompileInfo]] = possibles.tails.toSeq.map{
+  //          possiblesList =>
+  //          if (possiblesList.isEmpty) Nil
+  //          else {
+  //            val one = possiblesList.head
+  //            val rest = possiblesList.tail
+  //            val ambiguousSiblings = modelGroupSiblings(one, rest)
+  //            val allAmbiguous =
+  //                if (ambiguousSiblings.isEmpty) Nil
+  //            else one +: ambiguousSiblings
+  //            allAmbiguous
+  //          }
+  //        }
+  //          val firstAmbiguous = ambiguityLists
+  //          ambiguityLists.head
+  //        }
+
+  /**
+   * Returns others that are direct siblings of a specific one.
+   *
+   * Direct siblings means they have the same parent, but that parent
+   * cannot be a choice.
+   */
+  //  private def modelGroupSiblings(one: DPathElementCompileInfo, rest: Seq[DPathElementCompileInfo]): Seq[DPathElementCompileInfo] = {
+  //    rest.filter(r => one.immediateEnclosingCompileInfo eq r.immediateEnclosingCompileInfo &&
+  //        one.immediateEnclosingCompileInfo
+  //  }
   /**
    * Issues a good diagnostic with suggestions about near-misses on names
    * like missing prefixes.
@@ -435,8 +474,9 @@ class DPathElementCompileInfo(
     }
   }
 
-  final def queryMatchError(step: StepQName, matches: Seq[DPathElementCompileInfo]) = {
-    SDE("Statically ambiguous or query-style paths not supported in step path: '%s'. Matches are at locations:\n%s",
+  private def queryMatchWarning(step: StepQName, matches: Seq[DPathElementCompileInfo],
+    expr: ImplementsThrowsOrSavesSDE) = {
+    expr.SDW("Statically ambiguous or query-style paths not supported in step path: '%s'. Matches are at locations:\n%s",
       step, matches.map(_.schemaFileLocation.locationDescription).mkString("- ", "\n- ", ""))
   }
 }
diff --git a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ExpressionCompiler.scala b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ExpressionCompiler.scala
index bfef0d2cb..153fc97dc 100644
--- a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ExpressionCompiler.scala
+++ b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ExpressionCompiler.scala
@@ -36,12 +36,14 @@ import edu.illinois.ncsa.daffodil.dpath.NodeInfo
 import edu.illinois.ncsa.daffodil.xml.NamedQName
 import scala.xml.NamespaceBinding
 import java.lang.{ Long => JLong, Boolean => JBoolean }
+import edu.illinois.ncsa.daffodil.oolag.OOLAG._
 
 trait ExpressionCompilerBase[T <: AnyRef] {
 
   def compile(qn: NamedQName, nodeInfoKind: NodeInfo.Kind, exprWithBracesMaybe: String, namespaces: NamespaceBinding,
     compileInfoWherePropertyWasLocated: DPathCompileInfo,
-    isEvaluatedAbove: Boolean): CompiledExpression[T]
+    isEvaluatedAbove: Boolean,
+    host: OOLAGHost): CompiledExpression[T]
 
 }
 
diff --git a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/infoset/InfosetImpl.scala b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/infoset/InfosetImpl.scala
index 1458114c0..d37f4cf53 100644
--- a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/infoset/InfosetImpl.scala
+++ b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/infoset/InfosetImpl.scala
@@ -1334,10 +1334,29 @@ sealed class DIComplex(override val erd: ElementRuntimeData, val tunable: Daffod
     getChild(erd.dpathElementCompileInfo)
   }
 
+  private def noQuerySupportCheck(nodes: Seq[DINode], info: DPathElementCompileInfo) = {
+    if (nodes.length > 1) {
+      // might be more than one result
+      // but we have to rule out there being an empty DIArray
+      val withoutEmptyArrays = nodes.filter { node =>
+        node match {
+          case a: DIArray if a.length == 0 => false
+          case _ => true
+        }
+      }
+      if (withoutEmptyArrays.length > 1)
+        info.SDE("Path step '%s' ambiguous. More than one infoset node corresponds to this name.\n" +
+          "Query-style expressions are not supported.", info.namedQName.toExtendedSyntax)
+    }
+  }
+
   final def getChild(info: DPathElementCompileInfo): InfosetElement = {
-    if (nameToChildNodeLookup.containsKey(info.namedQName))
-      nameToChildNodeLookup.get(info.namedQName)(0).asInstanceOf[InfosetElement]
-    else
+    if (nameToChildNodeLookup.containsKey(info.namedQName)) {
+      val nodes = nameToChildNodeLookup.get(info.namedQName)
+      noQuerySupportCheck(nodes, info)
+      val node = nodes(0).asInstanceOf[InfosetElement]
+      node
+    } else
       throw new InfosetNoSuchChildElementException(this, info)
   }
 
@@ -1354,9 +1373,7 @@ sealed class DIComplex(override val erd: ElementRuntimeData, val tunable: Daffod
 
     val array = if (nameToChildNodeLookup.containsKey(name)) {
       val seq = nameToChildNodeLookup.get(name)
-      // Don't support query expressions yet, so should only have
-      // one item in the list
-      //
+      noQuerySupportCheck(seq, info)
       seq(0).asInstanceOf[InfosetArray] //.find(node => node.isInstanceOf[DIArray]).getOrElse(Assert.usageError("not an array")).asInstanceOf[InfosetArray]
     } else
       throw new InfosetNoSuchChildElementException(this, info)
@@ -1451,7 +1468,7 @@ sealed class DIComplex(override val erd: ElementRuntimeData, val tunable: Daffod
           nameToChildNodeLookup.remove(childToRemove.namedQName)
         else
           // not the last one, just drop the end
-          fastSeq.dropRight(1)
+          fastSeq.remove(fastSeq.length - 1)
       } else { /* Nothing to do? Doesn't exist. */ }
 
       i -= 1
diff --git a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/processors/RuntimeData.scala b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/processors/RuntimeData.scala
index 713a5b09c..27690c811 100644
--- a/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/processors/RuntimeData.scala
+++ b/daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/processors/RuntimeData.scala
@@ -943,11 +943,11 @@ final class VariableRuntimeData(
   @throws(classOf[java.io.IOException])
   final private def writeObject(out: java.io.ObjectOutputStream): Unit = serializeObject(out)
 
-  private val state =
+  private lazy val state =
     if (!maybeDefaultValueExpr.isDefined) VariableUndefined
     else VariableDefined
 
-  private val maybeValue: Maybe[AnyRef] =
+  private lazy val maybeValue: Maybe[AnyRef] =
     if (maybeDefaultValueExpr.isEmpty) Nope
     else {
       val defaultValueExpr = maybeDefaultValueExpr.get
diff --git a/daffodil-tdml/src/main/scala/edu/illinois/ncsa/daffodil/tdml/TDMLRunner.scala b/daffodil-tdml/src/main/scala/edu/illinois/ncsa/daffodil/tdml/TDMLRunner.scala
index 247a7a18f..7a74132a3 100644
--- a/daffodil-tdml/src/main/scala/edu/illinois/ncsa/daffodil/tdml/TDMLRunner.scala
+++ b/daffodil-tdml/src/main/scala/edu/illinois/ncsa/daffodil/tdml/TDMLRunner.scala
@@ -651,7 +651,10 @@ case class ParserTestCase(ptc: NodeSeq, parentArg: DFDLTestSuite)
     roundTrip: Boolean,
     tracer: Option[Debugger]) = {
 
-    val useSerializedProcessor = if (validationMode == ValidationMode.Full) false else true
+    val useSerializedProcessor =
+      if (validationMode == ValidationMode.Full) false
+      else if (optWarnings.isDefined) false
+      else true
     val nBits = optLengthLimitInBits.get
     val dataToParse = optDataToParse.get
 
@@ -697,37 +700,44 @@ case class ParserTestCase(ptc: NodeSeq, parentArg: DFDLTestSuite)
     optWarnings: Option[ExpectedWarnings],
     optValidationErrors: Option[ExpectedValidationErrors],
     validationMode: ValidationMode.Type) {
-
-    val diagnostics = {
-      if (processor.isError) processor.getDiagnostics
+    lazy val sw = new StringWriter()
+    val (diagnostics, isError: Boolean) = {
+      if (processor.isError) (processor.getDiagnostics, true)
       else {
-        val sw = new StringWriter()
+
         val out = new XMLTextInfosetOutputter(sw)
         val actual = processor.parse(dataToParse, out, lengthLimitInBits)
-        if (actual.isError) actual
-        else {
-          val loc: DataLocation = actual.resultState.currentLocation
-
-          if (!loc.isAtEnd) {
-            val leftOverMsg = "Left over data. Consumed %s bit(s) with %s bit(s) remaining.".format(loc.bitPos1b - 1, lengthLimitInBits - (loc.bitPos1b - 1))
-            actual.addDiagnostic(new GeneralParseFailure(leftOverMsg))
-            actual
-          } else {
-            // We did not get an error!!
-            // val diags = actual.getDiagnostics().map(_.getMessage()).foldLeft("")(_ + "\n" + _)
-            throw new TDMLException("Expected error. Didn't get one. Actual result was\n" + sw.toString)
+        val isErr: Boolean =
+          if (actual.isError) true
+          else {
+            //
+            // didn't get an error.
+            // If we're not at the end of data, synthesize an error for left-over-data
+            //
+            val loc: DataLocation = actual.resultState.currentLocation
+
+            if (!loc.isAtEnd) {
+              val leftOverMsg = "Left over data. Consumed %s bit(s) with %s bit(s) remaining.".format(loc.bitPos1b - 1, lengthLimitInBits - (loc.bitPos1b - 1))
+              actual.addDiagnostic(new GeneralParseFailure(leftOverMsg))
+              true
+            } else {
+              false
+            }
           }
-        }
-        processor.getDiagnostics ++ actual.getDiagnostics
+
+        val diagnostics = processor.getDiagnostics ++ actual.getDiagnostics
+        (diagnostics, isErr)
       }
     }
-
-    // check for any test-specified errors
-    VerifyTestCase.verifyAllDiagnosticsFound(diagnostics, Some(errors))
-
     // check for any test-specified warnings
     VerifyTestCase.verifyAllDiagnosticsFound(diagnostics, optWarnings)
-
+    if (isError) {
+      // good we expected an error
+      // check for any test-specified errors
+      VerifyTestCase.verifyAllDiagnosticsFound(diagnostics, Some(errors))
+    } else {
+      throw new TDMLException("Expected error. Didn't get one. Actual result was\n" + sw.toString)
+    }
   }
 
   def runParseExpectSuccess(processor: DFDL.DataProcessor,
@@ -790,10 +800,6 @@ case class ParserTestCase(ptc: NodeSeq, parentArg: DFDLTestSuite)
 
       leftOverException.map { throw _ } // if we get here, throw the left over data exception.
 
-      // TODO: Implement Warnings
-      // check for any test-specified warnings
-      //verifyAllDiagnosticsFound(actual, warnings)
-
       val allDiags = processor.getDiagnostics ++ actual.getDiagnostics
       VerifyTestCase.verifyAllDiagnosticsFound(allDiags, warnings)
 
@@ -876,12 +882,6 @@ case class UnparserTestCase(ptc: NodeSeq, parentArg: DFDLTestSuite)
     val processor = getProcessor(schemaSource, useSerializedProcessor)
     processor.right.foreach {
       case (warnings, proc) =>
-        //
-        // Print out the warnings
-        // (JIRA DFDL-1583 is implementation of expected warnings checking.)
-        //
-        warnings.foreach { System.err.println(_) }
-
         setupDebugOrTrace(proc)
     }
 
@@ -897,6 +897,8 @@ case class UnparserTestCase(ptc: NodeSeq, parentArg: DFDLTestSuite)
       case (_, Some(errors)) => {
         processor.left.foreach { diags =>
           VerifyTestCase.verifyAllDiagnosticsFound(diags, Some(errors))
+          // check warnings even if there are errors expected.
+          VerifyTestCase.verifyAllDiagnosticsFound(diags, optWarnings)
         }
         processor.right.foreach {
           case (warnings, processor) =>
@@ -942,9 +944,8 @@ case class UnparserTestCase(ptc: NodeSeq, parentArg: DFDLTestSuite)
       // we will need to treat as Hex bytes as well.
       VerifyTestCase.verifyBinaryOrMixedData(expectedData, outStream)
     }
-
-    // TODO: Implement Warnings - check for any test-specified warnings
-    // verifyAllDiagnosticsFound(actual, warnings)
+    val allDiags = actual.getDiagnostics ++ processor.getDiagnostics
+    VerifyTestCase.verifyAllDiagnosticsFound(allDiags, warnings)
 
     if (roundTrip) {
       val out = new ScalaXMLInfosetOutputter()
@@ -967,6 +968,7 @@ case class UnparserTestCase(ptc: NodeSeq, parentArg: DFDLTestSuite)
 
       val xmlNode = out.getResult
       VerifyTestCase.verifyParserTestData(xmlNode, inputInfoset)
+      VerifyTestCase.verifyAllDiagnosticsFound(actual.getDiagnostics, warnings)
 
       (shouldValidate, expectsValidationError) match {
         case (true, true) => {
@@ -1030,8 +1032,9 @@ case class UnparserTestCase(ptc: NodeSeq, parentArg: DFDLTestSuite)
       }
     }
 
-    // check for any test-specified errors
+    // check for any test-specified errors or warnings
     VerifyTestCase.verifyAllDiagnosticsFound(diagnostics, Some(errors))
+    VerifyTestCase.verifyAllDiagnosticsFound(diagnostics, optWarnings)
   }
 }
 
diff --git a/daffodil-tdml/src/test/resources/test/tdml/testWarnings.tdml b/daffodil-tdml/src/test/resources/test/tdml/testWarnings.tdml
new file mode 100644
index 000000000..dc43c5823
--- /dev/null
+++ b/daffodil-tdml/src/test/resources/test/tdml/testWarnings.tdml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<tdml:testSuite 
+  suiteName="tdml warnings" 
+  description="Tests for TDML Runner warnings features." 
+  xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:ex="http://example.com" 
+  xmlns:fn="http://www.w3.org/2005/xpath-functions">
+
+<tdml:defineSchema name="causesWarnings" elementFormDefault="unqualified">
+
+  <dfdl:format ref="ex:daffodilTest1" lengthKind="explicit" />
+
+  <xs:element name="causesWarnings" dfdl:lengthKind="implicit">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="A" type="xs:string" dfdl:length="1" />
+        <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" />
+        <xs:element name="B" type="xs:string" dfdl:length="1" />
+        <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" minOccurs="0" />
+        <xs:sequence>
+          <xs:annotation>
+            <xs:appinfo source="http://www.ogf.org/dfdl/">
+              <dfdl:discriminator>{ ./AmbigElt eq '2' }</dfdl:discriminator>
+            </xs:appinfo>
+          </xs:annotation>
+        </xs:sequence>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  
+    <xs:element name="errUnparsing" dfdl:lengthKind="implicit">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="A" type="xs:string" dfdl:length="1" />
+        <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" />
+        <xs:element name="B" type="xs:string" dfdl:length="1" />
+        <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" minOccurs="0" />
+        <xs:element name="UnparseFails" type="xs:string" dfdl:length="1"
+           dfdl:outputValueCalc="{ ../AmbigElt }"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+</tdml:defineSchema>
+
+<tdml:parserTestCase name="warningWhenExpectingError" root="causesWarnings" model="causesWarnings" description="TDML runner verifies warnings and errors.">
+
+  <tdml:document><![CDATA[1234]]></tdml:document>
+
+  <tdml:errors>
+    <tdml:error>Schema Definition Error</tdml:error>
+    <tdml:error>query-style</tdml:error>
+    <tdml:error>AmbigElt</tdml:error>
+  </tdml:errors>
+
+  <tdml:warnings>
+    <tdml:warning>Schema Definition Warning</tdml:warning>
+    <tdml:warning>AmbigElt</tdml:warning>
+    <tdml:warning>query-style</tdml:warning>
+  </tdml:warnings>
+</tdml:parserTestCase>
+
+<tdml:unparserTestCase name="unparserWarningWhenExpectingError" root="errUnparsing" model="causesWarnings" description="TDML runner verifies warnings and errors.">
+  <tdml:infoset>
+    <tdml:dfdlInfoset>
+      <ex:errUnparsing>
+        <A>1</A>
+        <AmbigElt>2</AmbigElt>
+        <B>3</B>
+        <AmbigElt>4</AmbigElt>
+      </ex:errUnparsing>
+    </tdml:dfdlInfoset>
+  </tdml:infoset>
+  
+  <tdml:document><![CDATA[12344]]></tdml:document>
+
+  <tdml:errors>
+    <tdml:error>Schema Definition Error</tdml:error>
+    <tdml:error>query-style</tdml:error>
+    <tdml:error>AmbigElt</tdml:error>
+  </tdml:errors>
+
+  <tdml:warnings>
+    <tdml:warning>Schema Definition Warning</tdml:warning>
+    <tdml:warning>AmbigElt</tdml:warning>
+    <tdml:warning>query-style</tdml:warning>
+  </tdml:warnings>
+</tdml:unparserTestCase>
+
+
+<tdml:parserTestCase name="warningWhenExpectingSuccess" root="causesWarnings" model="causesWarnings" description="TDML runner verifies warnings and infoset.">
+
+  <tdml:document><![CDATA[123]]></tdml:document>
+
+  <tdml:infoset>
+    <tdml:dfdlInfoset>
+      <ex:causesWarnings>
+        <A>1</A>
+        <AmbigElt>2</AmbigElt>
+        <B>3</B>
+      </ex:causesWarnings>
+    </tdml:dfdlInfoset>
+  </tdml:infoset>
+
+  <tdml:warnings>
+    <tdml:warning>Schema Definition Warning</tdml:warning>
+    <tdml:warning>query-style</tdml:warning>
+    <tdml:warning>AmbigElt</tdml:warning>
+  </tdml:warnings>
+</tdml:parserTestCase>
+
+<tdml:unparserTestCase name="unparserWarningWhenExpectingSuccess" root="causesWarnings" model="causesWarnings" description="TDML runner verifies warnings and infoset.">
+
+  <tdml:document><![CDATA[123]]></tdml:document>
+
+  <tdml:infoset>
+    <tdml:dfdlInfoset>
+      <ex:causesWarnings>
+        <A>1</A>
+        <AmbigElt>2</AmbigElt>
+        <B>3</B>
+      </ex:causesWarnings>
+    </tdml:dfdlInfoset>
+  </tdml:infoset>
+
+  <tdml:warnings>
+    <tdml:warning>Schema Definition Warning</tdml:warning>
+    <tdml:warning>query-style</tdml:warning>
+    <tdml:warning>AmbigElt</tdml:warning>
+  </tdml:warnings>
+</tdml:unparserTestCase>
+
+
+</tdml:testSuite>
diff --git a/daffodil-tdml/src/test/scala/edu/illinois/ncsa/daffodil/tdml/TestTDMLRunnerWarnings.scala b/daffodil-tdml/src/test/scala/edu/illinois/ncsa/daffodil/tdml/TestTDMLRunnerWarnings.scala
new file mode 100644
index 000000000..62b461525
--- /dev/null
+++ b/daffodil-tdml/src/test/scala/edu/illinois/ncsa/daffodil/tdml/TestTDMLRunnerWarnings.scala
@@ -0,0 +1,243 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.illinois.ncsa.daffodil.tdml
+
+import org.junit.Test
+import org.junit.AfterClass
+import edu.illinois.ncsa.daffodil.Implicits._
+import junit.framework.Assert.fail
+
+object TestTDMLRunnerWarnings {
+  val runner = Runner("/test/tdml/", "testWarnings.tdml")
+
+  @AfterClass def shutDown {
+    runner.reset
+  }
+}
+
+class TestTDMLRunnerWarnings {
+  import TestTDMLRunnerWarnings._
+
+  // DAFFODIL-1583
+  @Test def test_warningWhenExpectingSuccess() = { runner.runOneTest("warningWhenExpectingSuccess") }
+  @Test def test_warningWhenExpectingError() = { runner.runOneTest("warningWhenExpectingError") }
+  @Test def test_unparserWarningWhenExpectingSuccess() = { runner.runOneTest("unparserWarningWhenExpectingSuccess") }
+  @Test def test_unparserWarningWhenExpectingError() = { runner.runOneTest("unparserWarningWhenExpectingError") }
+
+  /*
+   * These tests insure that the TDML runner is actually testing the warnings.
+   * A TDML test could silently not even be checking the warnings and pass with false positive.
+   * These tests cause the TDML runner test to fail to find warnings, and check
+   * that we got the TDML runner to detect this.
+   */
+
+  @Test def testWarningsCheckedParserExpectingSuccess() = {
+    val testSuite =
+      <tdml:testSuite suiteName="tdml warnings" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ex="http://example.com" xmlns:fn="http://www.w3.org/2005/xpath-functions">
+        <tdml:defineSchema name="causesWarnings" elementFormDefault="unqualified">
+          <dfdl:format ref="ex:daffodilTest1" lengthKind="explicit"/>
+          <xs:element name="causesWarnings" dfdl:lengthKind="implicit">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="A" type="xs:string" dfdl:length="1"/>
+                <xs:element name="AmbigElt" type="xs:string" dfdl:length="1"/>
+                <xs:element name="B" type="xs:string" dfdl:length="1"/>
+                <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" minOccurs="0"/>
+                <xs:sequence>
+                  <xs:annotation>
+                    <xs:appinfo source="http://www.ogf.org/dfdl/">
+                      <dfdl:discriminator test="{ ./AmbigElt eq '2' }"/>
+                    </xs:appinfo>
+                  </xs:annotation>
+                </xs:sequence>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+        </tdml:defineSchema>
+        <tdml:parserTestCase name="warningWhenExpectingSuccess" root="causesWarnings" model="causesWarnings">
+          <tdml:document><![CDATA[123]]></tdml:document>
+          <tdml:infoset>
+            <tdml:dfdlInfoset>
+              <ex:causesWarnings>
+                <A>1</A>
+                <AmbigElt>2</AmbigElt>
+                <B>3</B>
+              </ex:causesWarnings>
+            </tdml:dfdlInfoset>
+          </tdml:infoset>
+          <tdml:warnings>
+            <tdml:warning>This will not be found</tdml:warning>
+          </tdml:warnings>
+        </tdml:parserTestCase>
+      </tdml:testSuite>
+
+    lazy val ts = new DFDLTestSuite(testSuite)
+    val e = intercept[Exception] {
+      ts.runOneTest("warningWhenExpectingSuccess")
+    }
+    val msg = e.getMessage()
+    System.err.println(msg)
+    if (!msg.contains("This will not be found")) {
+      println(msg)
+      fail("TDML Warnings were not checked")
+    }
+  }
+
+  @Test def testWarningsCheckedParserExpectingError() = {
+    val testSuite =
+      <tdml:testSuite suiteName="tdml warnings" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ex="http://example.com" xmlns:fn="http://www.w3.org/2005/xpath-functions">
+        <tdml:defineSchema name="causesWarnings" elementFormDefault="unqualified">
+          <dfdl:format ref="ex:daffodilTest1" lengthKind="explicit"/>
+          <xs:element name="causesWarnings" dfdl:lengthKind="implicit">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="A" type="xs:string" dfdl:length="1"/>
+                <xs:element name="AmbigElt" type="xs:string" dfdl:length="1"/>
+                <xs:element name="B" type="xs:string" dfdl:length="1"/>
+                <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" minOccurs="0"/>
+                <xs:sequence>
+                  <xs:annotation>
+                    <xs:appinfo source="http://www.ogf.org/dfdl/">
+                      <dfdl:discriminator test="{ ./AmbigElt eq '2' }"/>
+                    </xs:appinfo>
+                  </xs:annotation>
+                </xs:sequence>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+        </tdml:defineSchema>
+        <tdml:parserTestCase name="warningWhenExpectingError" root="causesWarnings" model="causesWarnings" description="TDML runner verifies warnings and errors.">
+          <tdml:document><![CDATA[1234]]></tdml:document>
+          <tdml:errors>
+            <tdml:error>Schema Definition Error</tdml:error>
+            <tdml:error>query-style</tdml:error>
+            <tdml:error>AmbigElt</tdml:error>
+          </tdml:errors>
+          <tdml:warnings>
+            <tdml:warning>This will not be found</tdml:warning>
+          </tdml:warnings>
+        </tdml:parserTestCase>
+      </tdml:testSuite>
+
+    lazy val ts = new DFDLTestSuite(testSuite)
+    val e = intercept[Exception] {
+      ts.runOneTest("warningWhenExpectingError")
+    }
+    val msg = e.getMessage()
+    System.err.println(msg)
+    if (!msg.contains("This will not be found")) {
+      println(msg)
+      fail("TDML Warnings were not checked")
+    }
+  }
+
+  @Test def testWarningsCheckedUnparserExpectingSuccess() = {
+    val testSuite =
+      <tdml:testSuite suiteName="tdml warnings" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ex="http://example.com" xmlns:fn="http://www.w3.org/2005/xpath-functions">
+        <tdml:defineSchema name="causesWarnings" elementFormDefault="unqualified">
+          <dfdl:format ref="ex:daffodilTest1" lengthKind="explicit"/>
+          <xs:element name="errUnparsing" dfdl:lengthKind="implicit">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="A" type="xs:string" dfdl:length="1"/>
+                <xs:element name="AmbigElt" type="xs:string" dfdl:length="1"/>
+                <xs:element name="B" type="xs:string" dfdl:length="1"/>
+                <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" minOccurs="0"/>
+                <xs:element name="UnparseFails" type="xs:string" dfdl:length="1" dfdl:outputValueCalc="{ ../AmbigElt }"/>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+        </tdml:defineSchema>
+        <tdml:unparserTestCase name="unparserWarningWhenExpectingSuccess" root="errUnparsing" model="causesWarnings" roundTrip="false">
+          <tdml:document><![CDATA[1232]]></tdml:document>
+          <tdml:infoset>
+            <tdml:dfdlInfoset>
+              <ex:errUnparsing>
+                <A>1</A>
+                <AmbigElt>2</AmbigElt>
+                <B>3</B>
+              </ex:errUnparsing>
+            </tdml:dfdlInfoset>
+          </tdml:infoset>
+          <tdml:warnings>
+            <tdml:warning>This will not be found</tdml:warning>
+          </tdml:warnings>
+        </tdml:unparserTestCase>
+      </tdml:testSuite>
+
+    lazy val ts = new DFDLTestSuite(testSuite)
+    val e = intercept[Exception] {
+      ts.runOneTest("unparserWarningWhenExpectingSuccess")
+    }
+    val msg = e.getMessage()
+    System.err.println(msg)
+    if (!msg.contains("This will not be found")) {
+      println(msg)
+      fail("TDML Warnings were not checked")
+    }
+  }
+
+  @Test def testWarningsCheckedUnparserExpectingError() = {
+    val testSuite =
+      <tdml:testSuite suiteName="tdml warnings" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ex="http://example.com" xmlns:fn="http://www.w3.org/2005/xpath-functions">
+        <tdml:defineSchema name="causesWarnings" elementFormDefault="unqualified">
+          <dfdl:format ref="ex:daffodilTest1" lengthKind="explicit"/>
+          <xs:element name="errUnparsing" dfdl:lengthKind="implicit">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="A" type="xs:string" dfdl:length="1"/>
+                <xs:element name="AmbigElt" type="xs:string" dfdl:length="1"/>
+                <xs:element name="B" type="xs:string" dfdl:length="1"/>
+                <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" minOccurs="0"/>
+                <xs:element name="UnparseFails" type="xs:string" dfdl:length="1" dfdl:outputValueCalc="{ ../AmbigElt }"/>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+        </tdml:defineSchema>
+        <tdml:unparserTestCase name="unparserWarningWhenExpectingError" root="errUnparsing" model="causesWarnings" roundTrip="false">
+          <tdml:infoset>
+            <tdml:dfdlInfoset>
+              <ex:errUnparsing>
+                <A>1</A>
+                <AmbigElt>2</AmbigElt>
+                <B>3</B>
+                <AmbigElt>4</AmbigElt>
+              </ex:errUnparsing>
+            </tdml:dfdlInfoset>
+          </tdml:infoset>
+          <tdml:document><![CDATA[1234]]></tdml:document>
+          <tdml:errors>
+            <tdml:error>Schema Definition Error</tdml:error>
+            <tdml:error>query-style</tdml:error>
+            <tdml:error>AmbigElt</tdml:error>
+          </tdml:errors>
+          <tdml:warnings>
+            <tdml:warning>This will not be found</tdml:warning>
+          </tdml:warnings>
+        </tdml:unparserTestCase>
+      </tdml:testSuite>
+
+    lazy val ts = new DFDLTestSuite(testSuite)
+    val e = intercept[Exception] {
+      ts.runOneTest("unparserWarningWhenExpectingError")
+    }
+    val msg = e.getMessage()
+    System.err.println(msg)
+    if (!msg.contains("This will not be found")) {
+      println(msg)
+      fail("TDML Warnings were not checked")
+    }
+  }
+}
diff --git a/daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section15/choice_groups/choice1773.tdml b/daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section15/choice_groups/choice1773.tdml
index b04ed0bad..6a2281814 100644
--- a/daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section15/choice_groups/choice1773.tdml
+++ b/daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section15/choice_groups/choice1773.tdml
@@ -110,13 +110,31 @@
     </xs:complexType>
   </xs:element>
 
+  <xs:element name="msgB" dfdl:ref="ex:complex">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="A" type="xs:string" dfdl:length="1" />
+        <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" />
+        <xs:element name="B" type="xs:string" dfdl:length="1" />
+        <xs:element name="AmbigElt" type="xs:string" dfdl:length="1" minOccurs="0"/>
+        <xs:sequence>
+          <xs:annotation>
+            <xs:appinfo source="http://www.ogf.org/dfdl/">
+              <dfdl:discriminator>{ ./AmbigElt eq '2' }</dfdl:discriminator>
+            </xs:appinfo>
+          </xs:annotation>
+        </xs:sequence>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+               
+
 </tdml:defineSchema>
 
   <tdml:parserTestCase name="choiceSlotAmbiguous1" root="msgA" model="s2" description="Choice branches with same element name inside.">
 
     <tdml:document><![CDATA[A1Y]]></tdml:document>
-<!--
-    This is the expected infoset when we resolve DFDL-1773 regarding statically ambiguous path expressions
+
     <tdml:infoset>
       <tdml:dfdlInfoset>
         <ex:msgA>
@@ -126,12 +144,6 @@
          </ex:msgA>
       </tdml:dfdlInfoset>
     </tdml:infoset>
--->
-    <tdml:errors>
-      <tdml:error>Statically ambiguous or query-style paths not supported</tdml:error>
-      <tdml:error>{}C</tdml:error>
-    </tdml:errors>
-
   </tdml:parserTestCase>
   
 
@@ -139,8 +151,6 @@
 
     <tdml:document><![CDATA[B2X]]></tdml:document>
 
-<!--
-    This is the expected infoset when we resolve DFDL-1773 regarding statically ambiguous path expressions
     <tdml:infoset>
       <tdml:dfdlInfoset>
         <ex:msgA>
@@ -150,13 +160,43 @@
          </ex:msgA>
       </tdml:dfdlInfoset>
     </tdml:infoset>
--->
+
+  </tdml:parserTestCase>
+  
+   <tdml:parserTestCase name="queryStyle1" root="msgB" model="s2" description="Query style expression gives warning and runtime SDE.">
+
+    <tdml:document><![CDATA[1234]]></tdml:document>
 
     <tdml:errors>
-      <tdml:error>Statically ambiguous or query-style paths not supported</tdml:error>
-      <tdml:error>{}C</tdml:error>
+      <tdml:error>Schema Definition Error</tdml:error>
+      <tdml:error>query-style</tdml:error>
+      <tdml:error>AmbigElt</tdml:error>
     </tdml:errors>
+    
+    <tdml:warnings>
+      <tdml:warning>Warning</tdml:warning>
+    </tdml:warnings>
+  </tdml:parserTestCase>   
+  
+  <tdml:parserTestCase name="queryStyle2" root="msgB" model="s2" description="Query style expression gives warning but not runtime SDE.">
 
+    <tdml:document><![CDATA[123]]></tdml:document>
+    
+    <tdml:infoset>
+      <tdml:dfdlInfoset>
+        <ex:msgB>
+         <A>1</A>
+         <AmbigElt>2</AmbigElt>
+         <B>3</B>
+        </ex:msgB>
+      </tdml:dfdlInfoset>
+    </tdml:infoset>
+    
+    <tdml:warnings>
+      <tdml:warning>Warning</tdml:warning>
+      <tdml:warning>query-style</tdml:warning>
+      <tdml:warning>AmbigElt</tdml:warning>
+    </tdml:warnings>
   </tdml:parserTestCase>
   
 
diff --git a/daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressionsDebug.scala b/daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressionsDebug.scala
index 226f0d6fe..0f93090fa 100644
--- a/daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressionsDebug.scala
+++ b/daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressionsDebug.scala
@@ -55,6 +55,9 @@ object TestDFDLExpressionsDebug {
   val runner4 = Runner(testDir4, "runtime-properties.tdml", validateTDMLFile = true, validateDFDLSchemas = false)
   val runner_fun = Runner(testDir, "functions.tdml")
 
+  val testDir5 = "/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/"
+  val runner5 = Runner(testDir5, "expressions.tdml")
+
   @AfterClass def shutDown() {
     runner4.reset
     runner.reset
@@ -177,4 +180,8 @@ class TestDFDLExpressionsDebug {
   @Test def test_nonNeg_constructor_02a() { runner2.runOneTest("nonNeg_constructor_02a") }
 
   @Test def test_element_long_form_whitespace() { runner.runOneTest("element_long_form_whitespace") }
+
+  // DFDL-1617 - should detect errors due to query-style expressions
+  @Test def test_query_style_01 { runner5.runOneTest("query_style_01") }
+  @Test def test_query_style_02 { runner5.runOneTest("query_style_02") }
 }
diff --git a/daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section15/choice_groups/TestChoice2.scala b/daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section15/choice_groups/TestChoice2.scala
index 230872839..8851f0bb2 100644
--- a/daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section15/choice_groups/TestChoice2.scala
+++ b/daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section15/choice_groups/TestChoice2.scala
@@ -61,4 +61,8 @@ class TestChoice2 {
   // DFDL-1773
   @Test def test_choiceSlotAmbiguous1(): Unit = { runner1773.runOneTest("choiceSlotAmbiguous1") }
   @Test def test_choiceSlotAmbiguous2(): Unit = { runner1773.runOneTest("choiceSlotAmbiguous2") }
+
+  // DAFFODIL-1773
+  @Test def test_queryStyle1(): Unit = { runner1773.runOneTest("queryStyle1") }
+  @Test def test_queryStyle2(): Unit = { runner1773.trace.runOneTest("queryStyle2") }
 }
diff --git a/daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressions2.scala b/daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressions2.scala
index 9b3070054..c99d94459 100644
--- a/daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressions2.scala
+++ b/daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressions2.scala
@@ -131,9 +131,6 @@ class TestDFDLExpressions2 {
   @Test def test_idiv19 { runner.runOneTest("idiv19") }
   @Test def test_idiv20 { runner.runOneTest("idiv20") }
 
-  // DFDL-1617
-  @Test def test_query_style_01 { runner4.runOneTest("query_style_01") }
-  @Test def test_query_style_02 { runner4.runOneTest("query_style_02") }
 
   // DFDL-1719
   @Test def test_if_expression_type_01 { runner5.runOneTest("if_expression_type_01") }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services