Skip to content

Commit

Permalink
Fix bit shifts on uint, long, and ulong
Browse files Browse the repository at this point in the history
- Extra operators were incorrectly being included in the operator finding, this was causing a cast check to fail down the line which was breaking << and >> on uint, long, and ulong. Prevent these types from including the conversion.
  • Loading branch information
MerlinVR committed Feb 26, 2020
1 parent 7ebe7cc commit 2041397
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Assets/UdonSharp/Editor/UdonSharpResolverContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,10 @@ public MethodBase FindBestOverloadFunction(MethodBase[] methods, List<System.Typ

if (!currentParam.ParameterType.IsImplicitlyAssignableFrom(argType) && !currentParam.HasParamsParameter() && !currentParam.ParameterType.IsByRef)
{
// Handle implicit upcasts to int from lower precision types
if (method is OperatorMethodInfo operatorParam &&
(operatorParam.operatorType == BuiltinOperatorType.LeftShift || operatorParam.operatorType == BuiltinOperatorType.RightShift))
(operatorParam.operatorType == BuiltinOperatorType.LeftShift || operatorParam.operatorType == BuiltinOperatorType.RightShift) &&
(argType != typeof(uint) && argType != typeof(ulong) && argType != typeof(long)))
{
if (UdonSharpUtils.GetNumericConversionMethod(currentParam.ParameterType, argType) == null)
{
Expand Down

0 comments on commit 2041397

Please sign in to comment.