ITADN

Incorrect ambiguous use of method error

#1874Opensimonvarey 创建于 2026-04-24
S
simonvareycommented
The following snippet: ``` @ffi("malloc") fun malloc(_ size: Int) -> MemoryAddress public fun main() { let out = malloc(1) let _ = UTF8Array(taking_ownership_of: out) } ``` produces the following error: ``` <source>:6.11-20: error: ambiguous use of 'UTF8Array' let _ = UTF8Array(taking_ownership_of: out) ~~~~~~~~~ /cefs/b2/b2697d9f2448ff965d1d1f01_hylo-trunk-20260416/Hylo_StandardLibrary.resources/Sources/Core/String/UTF8Array.hylo:55.3-57.4: note: candidate here public init() { ~~~~~~~~~~~~~~~~ /cefs/b2/b2697d9f2448ff965d1d1f01_hylo-trunk-20260416/Hylo_StandardLibrary.resources/Sources/Core/String/UTF8Array.hylo:64.3-92.4: note: candidate here public init( ``` Unless I'm very confused, a zero parameter method definition should never be a candidate for a non-zero argument call. (PS: I re-declared `malloc` here because it is not declared as public in `StandardLibrary/Sources/LibC.hylo`. This may well be the cause of the error, but even so the error diagnostic is incorrect).
1 条评论