Add test for structs/interface-blocks with invalid member names.

Structs already handled this appropriately, but interface blocks did not
guard against naming their member variables built-in type names like
"float" or "bool".

Change-Id: I12ec054b3f158b83e35031449cf2a088ff8d0dc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489596
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2021-12-28 14:58:36 -05:00
parent f604efbeb4
commit aa09c782a8
5 changed files with 27 additions and 0 deletions

View File

@ -66,6 +66,7 @@ sksl_error_tests = [
"/sksl/errors/InVarWithInitializerExpression.sksl",
"/sksl/errors/IncompleteExpression.sksl",
"/sksl/errors/IncompleteFunctionCall.sksl",
"/sksl/errors/InterfaceBlockMemberReservedName.sksl",
"/sksl/errors/InterfaceBlockReservedName.sksl",
"/sksl/errors/InterfaceBlockScope.sksl",
"/sksl/errors/InterfaceBlockStorageModifiers.sksl",
@ -194,6 +195,7 @@ sksl_error_tests = [
"/sksl/errors/StaticSwitchWithConditionalBreak.sksl",
"/sksl/errors/StaticSwitchWithConditionalContinue.sksl",
"/sksl/errors/StaticSwitchWithConditionalReturn.sksl",
"/sksl/errors/StructMemberReservedName.sksl",
"/sksl/errors/StructNameWithoutIdentifier.sksl",
"/sksl/errors/StructTooDeeplyNested.sksl",
"/sksl/errors/StructVariableReservedName.sksl",

View File

@ -0,0 +1,7 @@
IB {
float float;
} ib;
float4 main() {
return ib.float.xxxx;
}

View File

@ -0,0 +1,7 @@
struct S {
float float;
} s;
float4 main() {
return s.float.xxxx;
}

View File

@ -0,0 +1,7 @@
IB {
float float;
} ib;
vec4 main() {
return vec4(ib.float);
}

View File

@ -0,0 +1,4 @@
### Compilation failed:
error: 2: expected an identifier, but found type 'float'
1 error