Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Controls/src/SourceGen/Visitors/SetPropertiesVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,13 @@ static void Add(IndentedTextWriter writer, LocalVariable parentVar, XmlName prop
if (receiverType is not null && !propertyType!.Equals(receiverType, SymbolEqualityComparer.Default))
parentObj = $"(({receiverType.ToFQDisplayString()}){parentObj})";

//look for intermediate implicit casts
string cast = string.Empty;
if (HasDoubleImplicitConversion(context.Variables[valueNode].Type, itemType, context, out var conv))
cast = "(" + conv!.ReturnType.ToFQDisplayString() + ")";
Comment on lines +621 to +624
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method HasDoubleImplicitConversion is called but not defined in this file or visible in the diff. This will cause a compilation error unless this method exists elsewhere in the class or is imported.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get out, Copilot, you're drunk

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cast = "(" + conv!.ReturnType.ToFQDisplayString() + ")";
cast = $"({conv!.ReturnType.ToFQDisplayString()})";


using (PrePost.NewLineInfo(writer, (IXmlLineInfo)valueNode, context.FilePath))
writer.WriteLine($"{parentObj}.Add(({itemType.ToFQDisplayString()}){context.Variables[valueNode].Name});");
writer.WriteLine($"{parentObj}.Add(({itemType.ToFQDisplayString()}){cast}{context.Variables[valueNode].Name});");
}

static void AddToResourceDictionary(IndentedTextWriter writer, LocalVariable parentVar, IElementNode node, SourceGenContext context)
Expand Down
4 changes: 0 additions & 4 deletions src/Controls/tests/Xaml.UnitTests/Issues/Maui24900.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ public void TearDown()
}

[Test]
#if FIXME_BEFORE_PUBLIC_RELEASE
public void OnPlatformDoesNotThrow([Values(XamlInflator.XamlC, XamlInflator.Runtime)] XamlInflator inflator)
#else
public void OnPlatformDoesNotThrow([Values] XamlInflator inflator)
#endif
{
mockDeviceInfo.Platform = DevicePlatform.WinUI;
Assert.DoesNotThrow(() => new Maui24900(inflator));
Expand Down
8 changes: 0 additions & 8 deletions src/Controls/tests/Xaml.UnitTests/Issues/Maui4509.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,15 @@ public void TearDown()
}

[Test]
#if FIXME_BEFORE_PUBLIC_RELEASE
public void OnPlatformAsCollectionElementiOS([Values(XamlInflator.XamlC, XamlInflator.Runtime)] XamlInflator inflator)
#else
public void OnPlatformAsCollectionElementiOS([Values] XamlInflator inflator)
#endif
{
DeviceInfo.SetCurrent(new MockDeviceInfo(platform: DevicePlatform.iOS));
var page = new Maui4509(inflator);
Assert.That(page.layout.Children.Count, Is.EqualTo(2));
}

[Test]
#if FIXME_BEFORE_PUBLIC_RELEASE
public void OnPlatformAsCollectionElementAndroid([Values(XamlInflator.XamlC, XamlInflator.Runtime)] XamlInflator inflator)
#else
public void OnPlatformAsCollectionElementAndroid([Values] XamlInflator inflator)
#endif
{
DeviceInfo.SetCurrent(new MockDeviceInfo(platform: DevicePlatform.Android));
var page = new Maui4509(inflator);
Expand Down
Loading