Skip to content

Commit 76baf9d

Browse files
authored
[CS0162] Unreachable codes detected (#6509)
1 parent 535072c commit 76baf9d

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

src/core/Akka.Streams/Dsl/GraphDsl.cs

+6
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ internal void AddEdge<T1, T2>(Outlet<T1> from, Inlet<T2> to) where T2 : T1
5858
internal TShape Add<TShape, TMat, TMat2>(IGraph<TShape, TMat> graph, Func<TMat, TMat2> transform) where TShape : Shape
5959
{
6060
if (StreamLayout.IsDebug)
61+
#pragma warning disable CS0162 // Unreachable code detected
6162
StreamLayout.Validate(graph.Module);
63+
#pragma warning restore CS0162 // Unreachable code detected
6264

6365
var copy = graph.Module.CarbonCopy();
6466
_moduleInProgress = _moduleInProgress.Compose<TMat,TMat2,TMat2>(copy.TransformMaterializedValue(transform), Keep.Right);
@@ -80,7 +82,9 @@ internal TShape Add<TShape, TMat, TMat2>(IGraph<TShape, TMat> graph, Func<TMat,
8082
internal TShape Add<TShape, TMat1, TMat2, TMat3>(IGraph<TShape> graph, Func<TMat1, TMat2, TMat3> combine) where TShape : Shape
8183
{
8284
if (StreamLayout.IsDebug)
85+
#pragma warning disable CS0162 // Unreachable code detected
8386
StreamLayout.Validate(graph.Module);
87+
#pragma warning restore CS0162 // Unreachable code detected
8488

8589
var copy = graph.Module.CarbonCopy();
8690
_moduleInProgress = _moduleInProgress.Compose(copy, combine);
@@ -101,7 +105,9 @@ public TShape Add<TShape, TMat>(IGraph<TShape, TMat> graph)
101105
where TShape : Shape
102106
{
103107
if (StreamLayout.IsDebug)
108+
#pragma warning disable CS0162 // Unreachable code detected
104109
StreamLayout.Validate(graph.Module);
110+
#pragma warning restore CS0162 // Unreachable code detected
105111

106112
var copy = graph.Module.CarbonCopy();
107113
_moduleInProgress = _moduleInProgress.Compose<object, TMat, object>(copy, Keep.Left);

src/core/Akka.Streams/Implementation/ActorMaterializerImpl.cs

+2
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,9 @@ public override TMat Materialize<TMat>(IGraph<ClosedShape, TMat> runnable, Func<
369369
throw new IllegalStateException("Attempted to call Materialize() after the ActorMaterializer has been shut down.");
370370

371371
if (StreamLayout.IsDebug)
372+
#pragma warning disable CS0162 // Unreachable code detected
372373
StreamLayout.Validate(runnableGraph.Module);
374+
#pragma warning restore CS0162 // Unreachable code detected
373375

374376
var session = new ActorMaterializerSession(this, runnableGraph.Module, initialAttributes, subFlowFuser);
375377

src/core/Akka.Streams/Implementation/Fusing/Fusing.cs

+2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ public static Streams.Fusing.FusedGraph<TShape, TMat> Aggressive<TShape, TMat>(I
8585
Attributes.None,
8686
info);
8787

88+
#pragma warning disable CS0162 // Unreachable code detected
8889
if (StreamLayout.IsDebug) StreamLayout.Validate(module);
90+
#pragma warning restore CS0162 // Unreachable code detected
8991
if (IsDebug) Console.WriteLine(module.ToString());
9092

9193
return new Streams.Fusing.FusedGraph<TShape, TMat>(module, (TShape) shape);

src/core/Akka.Streams/Implementation/StreamLayout.cs

+8
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,9 @@ public virtual IModule Fuse<T1, T2, T3>(IModule other, OutPort from, InPort to,
648648
public virtual IModule Wire(OutPort from, InPort to)
649649
{
650650
if (StreamLayout.IsDebug)
651+
#pragma warning disable CS0162 // Unreachable code detected
651652
StreamLayout.Validate(this);
653+
#pragma warning restore CS0162 // Unreachable code detected
652654

653655
if (!OutPorts.Contains(from))
654656
{
@@ -687,7 +689,9 @@ public virtual IModule Wire(OutPort from, InPort to)
687689
public virtual IModule TransformMaterializedValue<TMat, TMat2>(Func<TMat, TMat2> mapFunc)
688690
{
689691
if (StreamLayout.IsDebug)
692+
#pragma warning disable CS0162 // Unreachable code detected
690693
StreamLayout.Validate(this);
694+
#pragma warning restore CS0162 // Unreachable code detected
691695

692696
return new CompositeModule(
693697
subModules: IsSealed ? ImmutableArray.Create(this as IModule) : SubModules,
@@ -720,7 +724,9 @@ public virtual IModule TransformMaterializedValue<TMat, TMat2>(Func<TMat, TMat2>
720724
public virtual IModule Compose<T1, T2, T3>(IModule other, Func<T1, T2, T3> matFunc)
721725
{
722726
if (StreamLayout.IsDebug)
727+
#pragma warning disable CS0162 // Unreachable code detected
723728
StreamLayout.Validate(this);
729+
#pragma warning restore CS0162 // Unreachable code detected
724730

725731
if (Equals(other, this))
726732
throw new ArgumentException(
@@ -787,7 +793,9 @@ private bool IsIgnorable(IModule module)
787793
public IModule ComposeNoMaterialized(IModule that)
788794
{
789795
if (StreamLayout.IsDebug)
796+
#pragma warning disable CS0162 // Unreachable code detected
790797
StreamLayout.Validate(this);
798+
#pragma warning restore CS0162 // Unreachable code detected
791799

792800
if (ReferenceEquals(this, that))
793801
throw new ArgumentException(

0 commit comments

Comments
 (0)