From 411ccd55df76db87f1cee68b06d8001b9cd7ad6d Mon Sep 17 00:00:00 2001 From: mertcandav Date: Fri, 6 Sep 2024 21:16:39 +0300 Subject: [PATCH] compiler: minor fixes for implicit import handling --- src/julec/obj/ir.jule | 8 ++++---- std/jule/sema/sema.jule | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/julec/obj/ir.jule b/src/julec/obj/ir.jule index c13e43f1d..86c6d6c08 100644 --- a/src/julec/obj/ir.jule +++ b/src/julec/obj/ir.jule @@ -184,10 +184,10 @@ fn pushRuntimeToAST(mut &f: &ast::Ast) { Binded: false, Std: true, } - if len(f.UseDecls) > 0 { - f.UseDecls = append(f.UseDecls[:1], f.UseDecls...) + f.UseDecls = append(f.UseDecls, decl) + if len(f.UseDecls) > 1 { + // If we have another use declarations, move decl to first item. + f.UseDecls[len(f.UseDecls)-1] = f.UseDecls[0] f.UseDecls[0] = decl - } else { - f.UseDecls = append(f.UseDecls, decl) } } \ No newline at end of file diff --git a/std/jule/sema/sema.jule b/std/jule/sema/sema.jule index 3bc3d26da..ccedab346 100644 --- a/std/jule/sema/sema.jule +++ b/std/jule/sema/sema.jule @@ -2448,7 +2448,7 @@ impl Sema { // If structure instance is comparable and have not custom compare method, // compiler will use default compare method. If There is array field, // push instance for runtime function. - if s.Comparable && s.Operators.Eq == nil { + if s.Comparable && s.Operators.Eq == nil && self.meta.runtime != nil { mut decl := runtimeFindFn(self.meta.runtime, runtimeFunc.arrayCmp) for (_, mut field) in s.Fields { mut arr := field.Kind.Arr()