private void CheckDiscrValAssignableToDiscrType(Literal discrVal, TypeContainer discrType) { Type clsDiscrType = discrType.GetCompactClsType(); if (!(clsDiscrType.IsEnum || clsDiscrType.Equals(typeof(System.Int16)) || clsDiscrType.Equals(typeof(System.Int32)) || clsDiscrType.Equals(typeof(System.Int64)) || clsDiscrType.Equals(typeof(System.Char)) || clsDiscrType.Equals(typeof(System.Boolean)))) { throw new InternalCompilerException("precond violation: discr type"); } if (!discrVal.IsAssignableTo(discrType)) { throw new InvalidIdlException( String.Format("discr val {0} not assignable to type: {1}", discrVal, clsDiscrType)); } }