-
Notifications
You must be signed in to change notification settings - Fork 847
Description
The code generated by the new (12.0.1.0 compiler for F# 6) which implicitly uses op_Implicit is generating code that doesn't work the same way that calling op_Implict (or using C#'s implicits) does.
This doesn't work
let conditionImplicit =
Cdn.Inputs.DeliveryRuleRequestSchemeConditionArgs(
Name = "RequestScheme1",
Parameters =
Cdn.Inputs.RequestSchemeMatchConditionParametersArgs(
MatchValues = matchValues,
Operator = Input.op_Implicit "Equal",
OdataType = Input.op_Implicit "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestSchemeConditionParameters"
)
)Not using implicit conversions does work
let conditionExplicit =
Cdn.Inputs.DeliveryRuleRequestSchemeConditionArgs(
Name = "RequestScheme2",
Parameters =
Input.op_Implicit (Cdn.Inputs.RequestSchemeMatchConditionParametersArgs(
MatchValues = matchValues,
Operator = Input.op_Implicit "Equal",
OdataType = Input.op_Implicit "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestSchemeConditionParameters"
))
)C#'s implicit conversions do work
var conditionImplicit =
new DeliveryRuleRequestSchemeConditionArgs {
Name = "RequestScheme1",
Parameters =
new RequestSchemeMatchConditionParametersArgs {
MatchValues = matchValues,
Operator = "Equal",
OdataType = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestSchemeConditionParameters"
}
};The repro case is at
https://github.com/marklam/ImplicitsProblem
It looks like the code generation (as disassembled with ILspy) is different for the F# implicit case. This means that when this code is used within a Pulumi app, errors like pulumi/pulumi-azure-native#1569 occur.
It seems like this is being produced by the implicit calls:
call class [Pulumi]Pulumi.Input`1<!0> class [Pulumi]Pulumi.Input`1<class [Pulumi.AzureNative]Pulumi.AzureNative.Cdn.Inputs.RequestSchemeMatchConditionParametersArgs>::op_Implicit(!0)
instead of
newobj instance void [Pulumi.AzureNative]Pulumi.AzureNative.Cdn.Inputs.DeliveryRuleRequestSchemeConditionArgs::.ctor()
Known workarounds
Enable warnings for implicit conversions, and use the old way (call op_Implicit yourself)
<WarnOn>3388;3391;3395</WarnOn>Related information
Provide any related information (optional):
- Windows 10
- Visual Studio 2022
- F# 6
- .NET Runtime 3.1
Metadata
Metadata
Assignees
Labels
Type
Projects
Status