Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions Assets/Tests/Editor/HotReload/HotReloadSameNameExtensionCaller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;

namespace io.github.hatayama.UnityCliLoop.Tests.Editor.HotReload
{
/// <summary>
/// Methods the same-name extension tests edit to call an internal extension method whose name a
/// public extension method of another class shares.
/// </summary>
public class HotReloadSameNameExtensionCaller
{
private int _seed = 50;

[MethodImpl(MethodImplOptions.NoInlining)]
public int OwnStatementsValue()
{
return 10;
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int LambdaValue()
{
Func<int> read = () => 20;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int ConditionalAccessLambdaValue()
{
Func<int> read = () => 30;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int MemberAccessReceiverLambdaValue()
{
Func<int> read = () => this._seed + 10;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int IntOverloadLambdaValue()
{
Func<int> read = () => 70;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int ChainedConditionalAccessLambdaValue()
{
Func<int> read = () => 80;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int NamedArgumentLambdaValue()
{
Func<int> read = () => 90;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public async Task<int> AsyncValue()
{
await Task.CompletedTask;
return 40;
}

[MethodImpl(MethodImplOptions.NoInlining)]
public IEnumerable<int> IteratorValues()
{
yield return 50;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;

namespace io.github.hatayama.UnityCliLoop.Tests.Editor.HotReload
{
/// <summary>
/// The partial-type counterpart of <see cref="HotReloadSameNameExtensionCaller"/>.
/// </summary>
public partial class HotReloadSameNameExtensionPartialCaller
{
private int _seed = 50;

[MethodImpl(MethodImplOptions.NoInlining)]
public int OwnStatementsValue()
{
return 10;
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int LambdaValue()
{
Func<int> read = () => 20;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int ConditionalAccessLambdaValue()
{
Func<int> read = () => 30;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int MemberAccessReceiverLambdaValue()
{
Func<int> read = () => this._seed + 10;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int IntOverloadLambdaValue()
{
Func<int> read = () => 70;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int ChainedConditionalAccessLambdaValue()
{
Func<int> read = () => 80;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public int NamedArgumentLambdaValue()
{
Func<int> read = () => 90;
return read();
}

[MethodImpl(MethodImplOptions.NoInlining)]
public async Task<int> AsyncValue()
{
await Task.CompletedTask;
return 40;
}

[MethodImpl(MethodImplOptions.NoInlining)]
public IEnumerable<int> IteratorValues()
{
yield return 50;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace io.github.hatayama.UnityCliLoop.Tests.Editor.HotReload
{
/// <summary>
/// Internal extension methods whose names a public extension method of another class, or a public
/// instance method of the receiver's type, shares.
/// </summary>
/// <remarks>
/// Why names of their own: a public extension method named like an existing fixture method would
/// change the outcome of every other test that calls that method, and one name per public
/// counterpart keeps each compiler error the tests rely on apart.
/// </remarks>
internal static class HotReloadSameNameInternalExtensionMath
{
internal static int AddDouble(this int value, int add)
{
return value * 2 + add;
}

internal static int AddTriple(this int value, int add)
{
return value * 3 + add;
}

internal static int AddQuadruple(this int value, int add)
{
return value * 4 + add;
}

internal static int AddQuintuple(this int value, int add)
{
return value * 5 + add;
}

internal static int Measure(this object value, int add)
{
return add + 1000;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
namespace io.github.hatayama.UnityCliLoop.Tests.Editor.HotReload
{
/// <summary>
/// Public extension methods that share their names with internal ones of another class and never
/// apply to the calls the tests make: one takes another receiver type, the others take an
/// <c>int</c> receiver with another argument type, fewer parameters or more parameters.
/// </summary>
public static class HotReloadSameNamePublicExtensionMath
{
public static int AddDouble(this string value, object other)
{
return value.Length;
}

// Why the parameter is named like the internal one's: a named argument then fails only on
// its type, as a positional one does.
public static int AddTriple(this int value, string add)
{
return value + add.Length;
}

public static int AddQuadruple(this int value)
{
return value;
}

public static int AddQuintuple(this int value, int add, int extra)
{
return value + add + extra;
}
}

/// <summary>
/// Public type whose public instance method shares its name with an internal extension method
/// of another class and does not take an <c>int</c> argument.
/// </summary>
public class HotReloadSameNameInstanceTarget
{
public int Measure(string text)
{
return text.Length;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading