diff --git a/src/Flame.Clr/Analysis/ClrMethodBodyAnalyzer.cs b/src/Flame.Clr/Analysis/ClrMethodBodyAnalyzer.cs
index 2a2f54459..99846aa97 100644
--- a/src/Flame.Clr/Analysis/ClrMethodBodyAnalyzer.cs
+++ b/src/Flame.Clr/Analysis/ClrMethodBodyAnalyzer.cs
@@ -289,8 +289,8 @@ private void AnalyzeExceptionHandler(
/// Analyzes a 'catch' exception handler's implementation.
///
/// The exception handler to analyze.
- ///
- /// The basic block tag of the landing pad to populate for the handler.
+ ///
+ /// The analyzed catch handler to populate.
///
/// A CIL method body.
private void AnalyzeCatchHandler(
@@ -344,8 +344,8 @@ private void AnalyzeCatchHandler(
/// Analyzes a 'filter' exception handler's implementation.
///
/// The exception handler to analyze.
- ///
- /// The basic block tag of the landing pad to populate for the handler.
+ ///
+ /// The analyzed filter handler to populate.
///
/// A CIL method body.
private void AnalyzeFilterHandler(
diff --git a/src/Flame.Compiler/Flow/ReturnFlow.cs b/src/Flame.Compiler/Flow/ReturnFlow.cs
index 66ccd5084..b534d26bf 100644
--- a/src/Flame.Compiler/Flow/ReturnFlow.cs
+++ b/src/Flame.Compiler/Flow/ReturnFlow.cs
@@ -35,7 +35,7 @@ public override BlockFlow WithInstructions(IReadOnlyList instructio
{
ContractHelpers.Assert(instructions.Count == 1, "Return flow takes exactly one instruction.");
var newReturnValue = instructions[0];
- if (object.ReferenceEquals(newReturnValue, ReturnValue))
+ if (newReturnValue.Equals(ReturnValue))
{
return this;
}
diff --git a/src/Flame.Compiler/Flow/SwitchFlow.cs b/src/Flame.Compiler/Flow/SwitchFlow.cs
index 621f70206..cd1362dfc 100644
--- a/src/Flame.Compiler/Flow/SwitchFlow.cs
+++ b/src/Flame.Compiler/Flow/SwitchFlow.cs
@@ -185,7 +185,7 @@ public override BlockFlow WithInstructions(IReadOnlyList instructio
{
ContractHelpers.Assert(instructions.Count == 1, "Switch flow takes exactly one instruction.");
var newSwitchValue = instructions[0];
- if (object.ReferenceEquals(newSwitchValue, SwitchValue))
+ if (newSwitchValue.Equals(SwitchValue))
{
return this;
}
diff --git a/src/Flame.Ir/ConstantCodec.cs b/src/Flame.Ir/ConstantCodec.cs
index c69def892..a66e7addf 100644
--- a/src/Flame.Ir/ConstantCodec.cs
+++ b/src/Flame.Ir/ConstantCodec.cs
@@ -75,9 +75,8 @@ public override LNode Encode(Constant value, EncoderState state)
{
// Encode other integer constants as custom literals.
return state.Factory.Literal(
- new CustomLiteral(
- integerConst.Value.ToString(),
- GSymbol.Get(integerConst.Spec.ToString())));
+ integerConst.Value.ToString(),
+ GSymbol.Get(integerConst.Spec.ToString()));
}
}
else if (value is Float32Constant)
@@ -253,6 +252,7 @@ private static bool TryDecomposeCustomLiteral(
out Symbol typeMarker)
{
var val = node.Value;
+#pragma warning disable CS0618 // Keep CustomLiteral support for backward compatibility with older encoded IR
if (val is CustomLiteral)
{
var literal = (CustomLiteral)val;
@@ -260,6 +260,13 @@ private static bool TryDecomposeCustomLiteral(
typeMarker = literal.TypeMarker;
return true;
}
+#pragma warning restore CS0618
+ else if (node.TypeMarker != null && node.TypeMarker.Name != "_")
+ {
+ value = val;
+ typeMarker = node.TypeMarker;
+ return true;
+ }
else
{
value = null;
diff --git a/src/Flame.Ir/DecoderState.cs b/src/Flame.Ir/DecoderState.cs
index 533a025f1..86e47303a 100644
--- a/src/Flame.Ir/DecoderState.cs
+++ b/src/Flame.Ir/DecoderState.cs
@@ -828,7 +828,7 @@ private BlockFlow DecodeBlockFlow(
return UnreachableFlow.Instance;
}
}
- else if (node.Calls(CodeSymbols.Switch))
+ else if (node.Calls(CodeSymbols.SwitchStmt))
{
// Decode the value being switched on as well as the default branch.
Instruction switchVal;
@@ -907,7 +907,7 @@ private BlockFlow DecodeBlockFlow(
Quotation.QuoteEvenInBold(
"unknown type of flow; expected one of ",
CodeSymbols.Goto.Name, ", ",
- CodeSymbols.Switch.Name, ", ",
+ CodeSymbols.SwitchStmt.Name, ", ",
CodeSymbols.Try.Name, ", ",
CodeSymbols.Return.Name, " or ",
EncoderState.unreachableFlowSymbol.Name, "."));
diff --git a/src/Flame.Ir/EncoderState.cs b/src/Flame.Ir/EncoderState.cs
index b584f20d3..da68c7059 100644
--- a/src/Flame.Ir/EncoderState.cs
+++ b/src/Flame.Ir/EncoderState.cs
@@ -36,7 +36,7 @@ public EncoderState(IrCodec codec, LNodeFactory factory)
public EncoderState(IrCodec codec)
: this(
codec,
- new LNodeFactory(EmptySourceFile.Default))
+ new LNodeFactory(EmptySourceFile.Synthetic))
{ }
///
@@ -457,7 +457,7 @@ private LNode Encode(
}
return Factory.Call(
- CodeSymbols.Switch,
+ CodeSymbols.SwitchStmt,
Encode(switchFlow.SwitchValue, valueNameMap),
Encode(switchFlow.DefaultBranch, blockNameMap, valueNameMap),
Factory.Call(CodeSymbols.Braces, caseNodes));
diff --git a/src/Flame.Ir/InstructionCodecElements.cs b/src/Flame.Ir/InstructionCodecElements.cs
index 3b8eb81ab..a97102666 100644
--- a/src/Flame.Ir/InstructionCodecElements.cs
+++ b/src/Flame.Ir/InstructionCodecElements.cs
@@ -242,7 +242,7 @@ private static IReadOnlyList EncodeIndirectCall(IndirectCallPrototype val
return new LNode[]
{
state.Encode(value.ResultType),
- state.Factory.List(paramTypeNodes)
+ state.Factory.AltList(paramTypeNodes)
};
}
@@ -279,7 +279,7 @@ private static IReadOnlyList EncodeIntrinsic(IntrinsicPrototype value, En
{
state.Factory.Id(value.Name),
state.Encode(value.ResultType),
- state.Factory.List(paramTypeNodes)
+ state.Factory.AltList(paramTypeNodes)
};
}
diff --git a/src/Flame.Ir/TypeCodec.cs b/src/Flame.Ir/TypeCodec.cs
index 47c275b04..11466f86b 100644
--- a/src/Flame.Ir/TypeCodec.cs
+++ b/src/Flame.Ir/TypeCodec.cs
@@ -39,7 +39,7 @@ private TypeCodec()
public static readonly TypeCodec Instance = new TypeCodec();
private static readonly Symbol pointerSymbol = GSymbol.Get("#pointer");
- private static readonly Symbol genericParameterSymbol = CodeSymbols.PtrArrow;
+ private static readonly Symbol genericParameterSymbol = CodeSymbols.RightArrow;
private Dictionary pointerKindEncoding;
private Dictionary pointerKindDecoding;
diff --git a/src/Flame/ContractHelpers.cs b/src/Flame/ContractHelpers.cs
index 7fe16b6a3..f6ca34236 100644
--- a/src/Flame/ContractHelpers.cs
+++ b/src/Flame/ContractHelpers.cs
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.Serialization;
namespace Flame
{
@@ -8,15 +7,11 @@ namespace Flame
///
public static class ContractHelpers
{
- [Serializable]
private class AssertionException : Exception
{
public AssertionException() { }
public AssertionException(string message) : base(message) { }
public AssertionException(string message, Exception inner) : base(message, inner) { }
- protected AssertionException(
- SerializationInfo info,
- StreamingContext context) : base(info, context) { }
}
///
diff --git a/src/UnitTests/Flame/DeferredInitializerTests.cs b/src/UnitTests/Flame/DeferredInitializerTests.cs
index 0bf4ad519..69d2be26b 100644
--- a/src/UnitTests/Flame/DeferredInitializerTests.cs
+++ b/src/UnitTests/Flame/DeferredInitializerTests.cs
@@ -71,7 +71,7 @@ public void TestMultithreadedInit()
public void RecursiveInit()
{
var integer = new Box(0);
- DeferredInitializer init;
+ DeferredInitializer init = default;
// This test makes sure that Initialize() does not recurse:
// calling Initialize() from Initialize() does nothing at all.
// This is by design, because it allows initialization to touch