@@ -54,13 +54,18 @@ pub enum ExpressionError {
5454 rhs_expr : Handle < crate :: Expression > ,
5555 rhs_type : crate :: TypeInner ,
5656 } ,
57- #[ error( "Expected selection argument types to match, but reject value of type {reject:?} does not match accept value of value {accept:?} " ) ]
57+ #[ error( "Expected selection reject and accept values ({accept:?} and {reject:?}, respectively) to match, but they have different types " ) ]
5858 SelectValuesTypeMismatch {
59- accept : crate :: TypeInner ,
60- reject : crate :: TypeInner ,
59+ accept : Handle < crate :: Expression > ,
60+ accept_ty : crate :: TypeInner ,
61+ reject : Handle < crate :: Expression > ,
62+ reject_ty : crate :: TypeInner ,
63+ } ,
64+ #[ error( "Expected selection condition {actual:?} to be a boolean value" ) ]
65+ SelectConditionNotABool {
66+ actual : Handle < crate :: Expression > ,
67+ actual_ty : crate :: TypeInner ,
6168 } ,
62- #[ error( "Expected selection condition to be a boolean value, got {actual:?}" ) ]
63- SelectConditionNotABool { actual : crate :: TypeInner } ,
6469 #[ error( "Relational argument {0:?} is not a boolean vector" ) ]
6570 InvalidBooleanVector ( Handle < crate :: Expression > ) ,
6671 #[ error( "Relational argument {0:?} is not a float" ) ]
@@ -162,8 +167,21 @@ impl ExpressionError {
162167 Self :: IndexableLength ( ..) => Vec :: new ( ) ,
163168 Self :: InvalidUnaryOperandType ( ..) => Vec :: new ( ) ,
164169 Self :: InvalidBinaryOperandTypes { .. } => Vec :: new ( ) ,
165- Self :: SelectValuesTypeMismatch { .. } => Vec :: new ( ) ,
166- Self :: SelectConditionNotABool { .. } => Vec :: new ( ) ,
170+ Self :: SelectValuesTypeMismatch {
171+ accept,
172+ ref accept_ty,
173+ reject,
174+ ref reject_ty,
175+ } => vec ! [
176+ ( accept, format!( "accept value of type {accept_ty:?}" ) ) ,
177+ ( reject, format!( "reject value of type {reject_ty:?}" ) ) ,
178+ ] ,
179+ Self :: SelectConditionNotABool {
180+ actual,
181+ ref actual_ty,
182+ } => {
183+ vec ! [ ( actual, format!( "this is of type {actual_ty:?}" ) ) ]
184+ }
167185 Self :: InvalidBooleanVector ( ..) => Vec :: new ( ) ,
168186 Self :: InvalidFloatArgument ( ..) => Vec :: new ( ) ,
169187 Self :: Type ( ..) => Vec :: new ( ) ,
@@ -1056,13 +1074,16 @@ impl super::Validator {
10561074 } ;
10571075 if accept_inner != reject_inner {
10581076 return Err ( ExpressionError :: SelectValuesTypeMismatch {
1059- accept : accept_inner. clone ( ) ,
1060- reject : reject_inner. clone ( ) ,
1077+ accept,
1078+ accept_ty : accept_inner. clone ( ) ,
1079+ reject,
1080+ reject_ty : reject_inner. clone ( ) ,
10611081 } ) ;
10621082 }
10631083 if !condition_good {
10641084 return Err ( ExpressionError :: SelectConditionNotABool {
1065- actual : condition_ty. clone ( ) ,
1085+ actual : condition,
1086+ actual_ty : condition_ty. clone ( ) ,
10661087 } ) ;
10671088 }
10681089 ShaderStages :: all ( )
0 commit comments