Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
fix comiplation error for .NET 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Aug 19, 2018
1 parent 8f32563 commit 8a8ddb8
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 26 deletions.
6 changes: 4 additions & 2 deletions Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#if CSHARP_7_OR_LATER
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

using System;
using System.Threading;
Expand Down Expand Up @@ -147,4 +148,5 @@ static int GetQueueIndex(int size)
}
}
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if UNITY_2018_1_OR_NEWER
#if CSHARP_7_OR_LATER

using System;
using UnityEngine;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if UNITY_2018_1_OR_NEWER
#if CSHARP_7_OR_LATER
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

using System;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if (NET_4_6 || NET_STANDARD_2_0) && CSHARP_7_OR_LATER
#if CSHARP_7_OR_LATER
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public static IObservable<string> OnValueChangedAsObservable(this InputField inp
}
#endif

#if UNITY_5_3_OR_NEWER

/// <summary>Observe onValueChanged with current `value` on subscribe.</summary>
public static IObservable<int> OnValueChangedAsObservable(this Dropdown dropdown)
{
Expand All @@ -113,6 +115,8 @@ public static IObservable<int> OnValueChangedAsObservable(this Dropdown dropdown
return d.onValueChanged.AsObservable().Subscribe(observer);
});
}

#endif
}
}

Expand Down
9 changes: 8 additions & 1 deletion Assets/Scripts/UnityTests/AsyncTestSample.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma warning disable CS1591
#if CSHARP_7_OR_LATER
#pragma warning disable CS1591

using UnityEngine.TestTools;
using System.Collections;
Expand All @@ -11,6 +12,8 @@

public class AsyncTestSample
{
#if ENABLE_WWW

[UnityTest]
public IEnumerator AsyncTest() => UniTask.ToCoroutine(async () =>
{
Expand All @@ -30,4 +33,8 @@ public IEnumerator AsyncTest() => UniTask.ToCoroutine(async () =>
var req = await UnityWebRequest.Get("http://google.co.jp/").SendWebRequest();
req.downloadHandler.text.Contains("<title>Google</title>").IsTrue();
});

#endif
}

#endif
16 changes: 6 additions & 10 deletions Assets/Scripts/UnityTests/ChainingAssertion.Unity.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#pragma warning disable CS1591

using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Reflection;

Expand All @@ -12,7 +9,6 @@
// no namespace.

[System.Diagnostics.DebuggerStepThroughAttribute]
[ContractVerification(false)]
public static partial class ChainingAssertion
{
/// <summary>Assert.AreEqual, if T is IEnumerable then CollectionAssert.AreEqual</summary>
Expand Down Expand Up @@ -219,7 +215,7 @@ public static void IsStructuralEqual(this object actual, object expected, string
if (!r.IsEquals)
{
var msg = string.Format("is not structural equal, failed at {0}, actual = {1} expected = {2}",
string.Join(".", r.Names), r.Left, r.Right);
string.Join(".", r.Names.ToArray()), r.Left, r.Right);
throw new AssertionException(msg, message);
}
}
Expand Down Expand Up @@ -318,9 +314,9 @@ static EqualInfo StructuralEqual(object left, object right, IEnumerable<string>
// is object
var fields = left.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public);
var properties = left.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).Where(x => x.GetGetMethod(false) != null);
var members = fields.Cast<MemberInfo>().Concat(properties);
var members = fields.Cast<MemberInfo>().Concat(properties.Cast<MemberInfo>());

foreach (var mi in fields.Cast<MemberInfo>().Concat(properties))
foreach (var mi in members)
{
var concatNames = names.Concat(new[] { (string)mi.Name });

Expand All @@ -336,8 +332,8 @@ static EqualInfo StructuralEqual(object left, object right, IEnumerable<string>
else
{
var i = mi as PropertyInfo;
lv = i.GetValue(left);
rv = i.GetValue(right);
lv = i.GetValue(left, null);
rv = i.GetValue(right, null);
}

var result = StructuralEqual(lv, rv, concatNames);
Expand Down
5 changes: 4 additions & 1 deletion Assets/Scripts/UnityTests/Rx/ArrayPoolTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
#if CSHARP_7_OR_LATER
using NUnit.Framework;
using System;
using UniRx.Async.Internal;
using System.Collections.Generic;
Expand Down Expand Up @@ -33,3 +34,5 @@ public void Rent()
}
}
}

#endif
6 changes: 3 additions & 3 deletions Assets/Scripts/UnityTests/Rx/MicroCoroutineTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public object Current
return null;
}
}
public int OriginalCount => original;
public int OriginalCount { get { return original; } }

public int Count => count;
public int Count { get { return count; } }

public bool MoveNext()
{
Expand All @@ -41,7 +41,7 @@ public void Reset()

public override string ToString()
{
return $"{count}/{original}";
return count + "/" + "original";
}
}

Expand Down
3 changes: 1 addition & 2 deletions Assets/Scripts/UnityTests/Rx/ReactivePropertyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;

namespace UniRx.Tests
Expand Down Expand Up @@ -357,7 +356,7 @@ public void FinishedSourceToReadOnlyReactiveProperty()
// immediate
{

var ex = new Exception();
// var ex = new Exception();
var source = new Subject<int>();
var rxProp = source.ToReadOnlyReactiveProperty();

Expand Down
7 changes: 3 additions & 4 deletions Assets/Scripts/UnityTests/Rx/SelectWhereOptimizeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UniRx.Tests
{
Expand All @@ -14,9 +13,9 @@ public class SelectWhereOptimizeTest
public void SelectSelect()
{
// Combine selector currently disabled.
var selectselect = Observable.Range(1, 10)
.Select(x => x)
.Select(x => x * -1);
//var selectselect = Observable.Range(1, 10)
// .Select(x => x)
// .Select(x => x * -1);
}

[Test]
Expand Down

0 comments on commit 8a8ddb8

Please sign in to comment.