-
Notifications
You must be signed in to change notification settings - Fork 93
Use record to get with
keyword.
#1040
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,32 +5,37 @@ | |
|
||
#nullable enable | ||
|
||
namespace System.Runtime.CompilerServices | ||
{ | ||
public class IsExternalInit {} | ||
} | ||
|
||
namespace Microsoft.Quantum.Runtime.Submitters | ||
{ | ||
/// <summary> | ||
/// Options for a job submitted to Azure Quantum. | ||
/// </summary> | ||
public class SubmissionOptions | ||
public record SubmissionOptions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it would be better to remove |
||
{ | ||
/// <summary> | ||
/// A name describing the job. | ||
/// </summary> | ||
public string FriendlyName { get; } | ||
public string FriendlyName { get; init; } | ||
|
||
/// <summary> | ||
/// The number of times the program will be executed. | ||
/// </summary> | ||
public int Shots { get; } | ||
public int Shots { get; init; } | ||
|
||
/// <summary> | ||
/// Additional target-specific parameters for the job. | ||
/// </summary> | ||
public ImmutableDictionary<string, string> InputParams { get; } | ||
public ImmutableDictionary<string, string> InputParams { get; init; } | ||
|
||
/// <summary> | ||
/// The target capability. | ||
/// </summary> | ||
public string TargetCapability { get; set; } | ||
public string TargetCapability { get; init; } | ||
|
||
/// <summary> | ||
/// The default submission options. | ||
|
@@ -60,7 +65,12 @@ public SubmissionOptions With( | |
int? shots = null, | ||
ImmutableDictionary<string, string>? inputParams = null, | ||
string? targetCapability = null) => | ||
new SubmissionOptions( | ||
friendlyName ?? FriendlyName, shots ?? Shots, inputParams ?? InputParams, targetCapability ?? TargetCapability); | ||
this with | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good, my only thought was to not break existing callers, but happy to go on and pull that method, then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To unblock e2e, would it be OK to mark this and |
||
{ | ||
FriendlyName = friendlyName ?? FriendlyName, | ||
Shots = shots ?? Shots, | ||
InputParams = inputParams ?? InputParams, | ||
TargetCapability = targetCapability ?? TargetCapability | ||
}; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a public type, won't this conflict if another reference uses the same workaround? Can we update Microsoft.Quantum.Runtime.Core target framework to net6.0 instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested in other places, and that type seems to be special-cased to not conflict, allowing this as a suggested workaround (as per https://developercommunity.visualstudio.com/t/error-cs0518-predefined-type-systemruntimecompiler/1244809).