Skip to content

Commit

Permalink
fix: legitimate lazy being detected as not registered (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
glennawatson authored Jul 18, 2021
1 parent eece4bc commit eec99d0
Show file tree
Hide file tree
Showing 8 changed files with 579 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
//HintName: Splat.DI.Extensions.SourceGenerated.cs

// <auto-generated />
namespace Splat
{
/// <summary>
/// Extension methods for the Splat DI source generator.
/// </summary>
internal static partial class SplatRegistrations
{
/// <summary>
/// Registers a class with its concrete class.
/// </summary>
public static void Register<TInterface, TConcrete>()
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void Register<TInterface, TConcrete>(string contract)
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
public static void RegisterLazySingleton<TInterface, TConcrete>()
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="mode">The threading mode.</param>
public static void RegisterLazySingleton<TInterface, TConcrete>(System.Threading.LazyThreadSafetyMode mode)
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void RegisterLazySingleton<TInterface, TConcrete>(string contract)
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
/// <param name="mode">The threading mode.</param>
public static void RegisterLazySingleton<TInterface, TConcrete>(string contract, System.Threading.LazyThreadSafetyMode mode)
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
public static void Register<T>()
{
}


/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void Register<T>(string contract)
{
}

/// <summary>
/// Registers a lazy class with its concrete class.
/// </summary>
public static void RegisterLazySingleton<T>()
{
}


/// <summary>
/// Registers a lazy class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void RegisterLazySingleton<T>(string contract)
{
}

/// <summary>
/// Proxy for the Splat SetService.
/// </summary>
public static void RegisterConstant<T>(T instance) => Splat.Locator.CurrentMutable.RegisterConstant<T>(instance);

/// <summary>
/// Proxy for the Splat SetService.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void RegisterConstant<T>(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant<T>(instance, contract);

/// <summary>
/// Registers the registrations.
/// </summary>
public static void SetupIOC()
{
SetupIOCInternal(Splat.Locator.GetLocator());
}

/// <summary>
/// Registers the registrations.
/// </summary>
/// <param name="resolver">The resolver to register with.</param>
public static void SetupIOC(Splat.IDependencyResolver resolver)
{
SetupIOCInternal(resolver);
}


static partial void SetupIOCInternal(Splat.IDependencyResolver resolver);
}

/// <summary>
/// Makes the property get added by the DI engine.
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Property)]
internal class DependencyInjectionPropertyAttribute : System.Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="DependencyInjectionPropertyAttribute"/> class.
/// </summary>
public DependencyInjectionPropertyAttribute()
{
}
}

/// <summary>
/// Makes this the constructor used by the DI engine.
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Constructor)]
internal class DependencyInjectionConstructorAttribute : System.Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="DependencyInjectionConstructorAttribute"/> class.
/// </summary>
public DependencyInjectionConstructorAttribute()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//HintName: Splat.DI.Extensions.Registrations.SourceGenerated.cs

// <auto-generated />
namespace Splat
{
internal static partial class SplatRegistrations
{
static partial void SetupIOCInternal( Splat.IDependencyResolver resolver)
{
Splat.Locator.CurrentMutable.Register(() => new global::Test.TestConcrete((global::Test.IService1)resolver.GetService(typeof(global::Test.IService1)), (global::System.Lazy<global::Test.IService2>)resolver.GetService(typeof(global::System.Lazy<global::Test.IService2>))){ ServiceProperty1=(global::Test.IServiceProperty1)resolver.GetService(typeof(global::Test.IServiceProperty1)), ServiceProperty2=(global::Test.IServiceProperty2)resolver.GetService(typeof(global::Test.IServiceProperty2)), ServiceProperty3=(global::Test.IServiceProperty3)resolver.GetService(typeof(global::Test.IServiceProperty3))} , typeof(global::Test.ITest));
Splat.Locator.CurrentMutable.Register(() => new global::Test.Service1(), typeof(global::Test.IService1));
{
global::System.Lazy<Test.IService2> lazy = new global::System.Lazy<Test.IService2>(() => new global::Test.Service2());
Splat.Locator.CurrentMutable.Register(() => lazy, typeof(global::System.Lazy<Test.IService2>));
Splat.Locator.CurrentMutable.Register(() => lazy.Value, typeof(global::Test.IService2));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
//HintName: Splat.DI.Extensions.SourceGenerated.cs

// <auto-generated />
namespace Splat
{
/// <summary>
/// Extension methods for the Splat DI source generator.
/// </summary>
internal static partial class SplatRegistrations
{
/// <summary>
/// Registers a class with its concrete class.
/// </summary>
public static void Register<TInterface, TConcrete>()
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void Register<TInterface, TConcrete>(string contract)
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
public static void RegisterLazySingleton<TInterface, TConcrete>()
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="mode">The threading mode.</param>
public static void RegisterLazySingleton<TInterface, TConcrete>(System.Threading.LazyThreadSafetyMode mode)
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void RegisterLazySingleton<TInterface, TConcrete>(string contract)
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
/// <param name="mode">The threading mode.</param>
public static void RegisterLazySingleton<TInterface, TConcrete>(string contract, System.Threading.LazyThreadSafetyMode mode)
{
}

/// <summary>
/// Registers a class with its concrete class.
/// </summary>
public static void Register<T>()
{
}


/// <summary>
/// Registers a class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void Register<T>(string contract)
{
}

/// <summary>
/// Registers a lazy class with its concrete class.
/// </summary>
public static void RegisterLazySingleton<T>()
{
}


/// <summary>
/// Registers a lazy class with its concrete class.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void RegisterLazySingleton<T>(string contract)
{
}

/// <summary>
/// Proxy for the Splat SetService.
/// </summary>
public static void RegisterConstant<T>(T instance) => Splat.Locator.CurrentMutable.RegisterConstant<T>(instance);

/// <summary>
/// Proxy for the Splat SetService.
/// </summary>
/// <param name="contract">Optional contract.</param>
public static void RegisterConstant<T>(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant<T>(instance, contract);

/// <summary>
/// Registers the registrations.
/// </summary>
public static void SetupIOC()
{
SetupIOCInternal(Splat.Locator.GetLocator());
}

/// <summary>
/// Registers the registrations.
/// </summary>
/// <param name="resolver">The resolver to register with.</param>
public static void SetupIOC(Splat.IDependencyResolver resolver)
{
SetupIOCInternal(resolver);
}


static partial void SetupIOCInternal(Splat.IDependencyResolver resolver);
}

/// <summary>
/// Makes the property get added by the DI engine.
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Property)]
internal class DependencyInjectionPropertyAttribute : System.Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="DependencyInjectionPropertyAttribute"/> class.
/// </summary>
public DependencyInjectionPropertyAttribute()
{
}
}

/// <summary>
/// Makes this the constructor used by the DI engine.
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Constructor)]
internal class DependencyInjectionConstructorAttribute : System.Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="DependencyInjectionConstructorAttribute"/> class.
/// </summary>
public DependencyInjectionConstructorAttribute()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//HintName: Splat.DI.Extensions.Registrations.SourceGenerated.cs

// <auto-generated />
namespace Splat
{
internal static partial class SplatRegistrations
{
static partial void SetupIOCInternal( Splat.IDependencyResolver resolver)
{
Splat.Locator.CurrentMutable.Register(() => new global::Test.TestConcrete((global::Test.IService1)resolver.GetService(typeof(global::Test.IService1)), (global::System.Lazy<global::Test.IService2>)resolver.GetService(typeof(global::System.Lazy<global::Test.IService2>))){ ServiceProperty1=(global::Test.IServiceProperty1)resolver.GetService(typeof(global::Test.IServiceProperty1)), ServiceProperty2=(global::Test.IServiceProperty2)resolver.GetService(typeof(global::Test.IServiceProperty2)), ServiceProperty3=(global::Test.IServiceProperty3)resolver.GetService(typeof(global::Test.IServiceProperty3))} , typeof(global::Test.ITest), "Test1");
Splat.Locator.CurrentMutable.Register(() => new global::Test.Service1(), typeof(global::Test.IService1), "Test1");
{
global::System.Lazy<Test.IService2> lazy = new global::System.Lazy<Test.IService2>(() => new global::Test.Service2());
Splat.Locator.CurrentMutable.Register(() => lazy, typeof(global::System.Lazy<Test.IService2>), "Test1");
Splat.Locator.CurrentMutable.Register(() => lazy.Value, typeof(global::Test.IService2), "Test1");
}
}
}
}
Loading

0 comments on commit eec99d0

Please sign in to comment.