@@ -134,13 +134,17 @@ private static bool IsRESPite(ITypeSymbol? symbol, RESPite type)
134134 private enum SERedis
135135 {
136136 CommandFlags ,
137+ RedisValue ,
138+ RedisKey ,
137139 }
138140
139141 private static bool IsSERedis ( ITypeSymbol ? symbol , SERedis type )
140142 {
141143 static string NameOf ( SERedis type ) => type switch
142144 {
143145 SERedis . CommandFlags => nameof ( SERedis . CommandFlags ) ,
146+ SERedis . RedisValue => nameof ( SERedis . RedisValue ) ,
147+ SERedis . RedisKey => nameof ( SERedis . RedisKey ) ,
144148 _ => type . ToString ( ) ,
145149 } ;
146150
@@ -481,14 +485,15 @@ void AddLiteral(string token, LiteralFlags literalFlags)
481485 var val = attrib . ConstructorArguments [ 0 ] . Value ;
482486 var expr = val switch
483487 {
484- string s => CodeLiteral ( s ) ,
485- bool b => b ? "true" : "false" ,
488+ null when IsSERedis ( param . Type , SERedis . RedisValue ) | IsSERedis ( param . Type , SERedis . RedisKey ) => ".IsNull is false" ,
489+ string s => " != " + CodeLiteral ( s ) ,
490+ bool b => b ? " is false" : " is true" , // if we *ignore* true, then "incN = foo is false"
486491 long l when attrib . ConstructorArguments [ 0 ] . Type is INamedTypeSymbol { EnumUnderlyingType : not null } enumType
487- => GetEnumExpression ( enumType , l ) ,
488- long l => l . ToString ( CultureInfo . InvariantCulture ) ,
492+ => " != " + GetEnumExpression ( enumType , l ) ,
493+ long l => " != " + l . ToString ( CultureInfo . InvariantCulture ) ,
489494 int i when attrib . ConstructorArguments [ 0 ] . Type is INamedTypeSymbol { EnumUnderlyingType : not null } enumType
490- => GetEnumExpression ( enumType , i ) ,
491- int i => i . ToString ( CultureInfo . InvariantCulture ) ,
495+ => " != " + GetEnumExpression ( enumType , i ) ,
496+ int i => " != " + i . ToString ( CultureInfo . InvariantCulture ) ,
492497 _ => null ,
493498 } ;
494499
@@ -1016,10 +1021,10 @@ void WriteParameterName(in ParameterTuple p, StringBuilder? target = null)
10161021 case ParameterFlags . Nullable | ParameterFlags . IgnoreExpression :
10171022 sb . Append ( " is { } __val" ) . Append ( parameter . ArgIndex )
10181023 . Append ( " && __val" ) . Append ( parameter . ArgIndex )
1019- . Append ( " != " ) . Append ( parameter . IgnoreExpression ) ;
1024+ . Append ( parameter . IgnoreExpression ) ;
10201025 break ;
10211026 case ParameterFlags . IgnoreExpression :
1022- sb . Append ( " != " ) . Append ( parameter . IgnoreExpression ) ;
1027+ sb . Append ( parameter . IgnoreExpression ) ;
10231028 break ;
10241029 case ParameterFlags . Collection :
10251030 // non-nullable collection; literals already handled
@@ -1103,7 +1108,7 @@ void WriteParameterName(in ParameterTuple p, StringBuilder? target = null)
11031108 // help identify what this is (not needed for collections, since foo.Count etc)
11041109 sb . Append ( " // " ) ;
11051110 WriteParameterName ( parameter ) ;
1106- if ( argCount != 1 ) sb . Append ( " (" ) . Append ( parameter . Name ) . Append ( ")" ) ; // give an example
1111+ if ( tuple . Value . ShareCount != 1 ) sb . Append ( " (" ) . Append ( parameter . Name ) . Append ( ")" ) ; // give an example
11071112 }
11081113
11091114 if ( literalCount != 0 )
0 commit comments