model: the anonymous constructor is now called `autoinit`
[nit.git] / src / nitni / nitni_callbacks.nit
index 8542a95..4543308 100644 (file)
@@ -219,7 +219,7 @@ class MExplicitCall
 
                        var cname
                        if mproperty.is_init then
-                               if mproperty.name == "init" or mproperty.name == "new" then
+                               if mproperty.name == "init" or mproperty.name == "new" or mproperty.name == "autoinit" then
                                        cname = "new_{recv_mtype.mangled_cname}"
                                else
                                        cname = "new_{recv_mtype.mangled_cname}_{mproperty.short_cname}"
@@ -287,7 +287,7 @@ redef class ALocalPropExternCall
                        mmodule, mclass_type, m_name )
 
                if method == null then
-                       toolcontext.error(location, "Local method {m_name} not found.")
+                       toolcontext.error(location, "Error: local method `{m_name}` not found.")
                        return
                end
 
@@ -313,7 +313,7 @@ redef class AFullPropExternCall
                end
 
                if mtype isa MNullableType then
-                       toolcontext.error(location, "Type {n_type.collect_text} is nullable and thus cannot be the receiver." )
+                       toolcontext.error(location, "Error: type `{n_type.collect_text}` is nullable and thus cannot be the receiver." )
                        return
                end
 
@@ -322,7 +322,7 @@ redef class AFullPropExternCall
                        mmodule, mtype, m_name )
 
                if method == null then
-                       toolcontext.error(location, "Method {m_name} not found in {n_type.collect_text}." )
+                       toolcontext.error(location, "Error: method `{m_name}` not found in `{n_type.collect_text}`." )
                        return
                end
 
@@ -341,7 +341,7 @@ redef class AInitPropExternCall
                if mtype == null then return
 
                if not mtype isa MClassType then
-                       toolcontext.error(location, "Type {n_type.collect_text} is not a class and thus cannot be used to instanciate a new instance." )
+                       toolcontext.error(location, "Error: type `{n_type.collect_text}` is not a class and thus cannot be used to instantiate a new instance." )
                        return
                end
 
@@ -350,13 +350,13 @@ redef class AInitPropExternCall
                        mmodule, mtype, meth_name )
 
                if meth == null then
-                       meth_name = "init"
+                       meth_name = "autoinit"
                        meth = toolcontext.modelbuilder.try_get_mproperty_by_name2( self,
                                mmodule, mtype, meth_name )
                end
 
                if meth == null then
-                       toolcontext.error(location, "Method {meth_name} not found in {n_type.collect_text}." )
+                       toolcontext.error(location, "Error: method `{meth_name}` not found in `{n_type.collect_text}`." )
                        return
                end
 
@@ -422,7 +422,7 @@ redef class AAsNotNullableExternCall
        redef fun from_mtype do return n_type.mtype.as_nullable
        redef fun to_mtype do
                var mtype = n_type.mtype.as(not null)
-               mtype = mtype.as_notnullable
+               mtype = mtype.undecorate
                return mtype
        end