diff --git a/src/MLIR.jl b/src/MLIR.jl index b068b042..66d38bc8 100644 --- a/src/MLIR.jl +++ b/src/MLIR.jl @@ -35,6 +35,10 @@ function Base.unsafe_convert(::Type{API.MlirStringRef}, s::Union{Symbol, String, return API.MlirStringRef(p, sizeof(s)) end +function Base.String(str::API.MlirStringRef) + Base.unsafe_string(pointer(str.data), str.length) +end + module IR import ..API: API diff --git a/test/runtests.jl b/test/runtests.jl index 9b482217..170af3c3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,3 +12,10 @@ include("executionengine.jl") @test s == reconstructed end + +@testset "show" begin + MLIR.IR.context!(MLIR.IR.Context()) do + dialect = MLIR.IR.get_or_load_dialect!("llvm") + @test sprint(show, dialect) == "Dialect(\"llvm\")" + end +end