What v0.4.0 does not accept

The rule of the cut is no silently wrong result: a construct that is not taught is refused where it is written, with a teko: <cause> naming it. This page is the list, with the message each one answers.

Nothing here is a promise about a later version; what is designed and not built lives in ../specs/.


Types and declarations #

writtenmessage
a type inside a typeteko: a type is declared at top level; there is no type inside a type
partial on a methodteko: a partial method is not taught; only a partial class
abstract in a traitteko: `abstract` in a trait not taught yet
a const in a traitteko: a trait brings no const; only a class or struct declares one
insteadof / as in a use blockteko: `insteadof`/`as` in a `use` block not taught yet
an operator on an interfaceteko: an operator is declared by a class or a struct, not by an interface
a const local to a functionteko: a local const is not taught; declare it at the top or as a member
varteko: var not taught yet
matchteko: match not taught yet
a standalone whenteko: when not taught yet
type X = ...not taught: there is no type alias in the surface
a variant / discriminated unionnot taught
sbyte, short, ushort, int, uint, long, ulongnot taught: ordinary identifiers, because teko registers none of the seven C# alias words — i8/i16 are type_new primitives of their own, spelled mc's way, not C#'s (types.md)

Interfaces have no covariance and no contravariance, and a struct has no reference count of its own (memory.md).

Numeric conversions #

An integer converts to a float in every slot that has one, and nothing narrows back (types.md). What is still missing around it:

writtenwhat happens
f64 d = s; with an f32 sneither converted nor refused: the four bytes are read as eight, so the value is wrong. The two float widths convert to each other in neither direction
7 % 2.5the remainder is not promoted — the integer operand stays one, and the float's bit pattern is read as an integer. 2.5 % 7 is mc: no float remainder, the backend having no float remainder instruction at all
2.5 << 1, 2.5 & 1a shift and the bitwise operators take no float in C# and are not promoted here either
an integer argument at a virtual or an interface call, written as a bare parameter name (a.by(n) inside g(i64 n))not converted: those two are shaped at parse time and a parameter carries no type the parser can read, so the argument passes its own bits
(i64) p.w on a fieldteko: i64 has no members: w — the cast binds tighter than the ., so it reads as ((i64) p).w. Write the load into a local first, f64 v = p.w;
h.f = 5; on a field of class/struct/interface/delegate type, the value written by a PARSE-TIME field store (p.f = e)neither converted nor refused: tk_check_field_store (teko_struct.tk) reads the value through tk_struct_of_expr, which answers about an OBJECT expression only, so a scalar value silently answers "not known" and the store proceeds, writing the integer's bit pattern where a pointer is expected. D34 fixed the opposite direction (a reference reaching a NUMERIC field); this is the same defect class, the other way round, at this one site — every other numeric-into-reference slot (an initializer, an assignment, an argument, a return) already refuses through tk_check_compat's row check

Generics and delegates #

writtenmessage
a qualified generic (geo.Box<i64>)not taught: a generic declared in a namespace keeps its short name
a generic delegatenot taught
Func<> / Action<>teko: not a generic type — there is no generic delegate to instantiate
f += g / f -= g on a delegate (multicast)teko: <Type> declares no operator + / teko: no operator `+` takes these operands
op.Invoke(x)not taught: a delegate value is called as op(x)
delegate covariance / contravariancenot taught
return (i64 x) => e;not taught: write return new Op((i64 x) => e);
a capture by reference of a counted typeteko: a capture by reference of a counted type is not taught yet
capturing a parameter of the declaring functionteko: `use` captures a local; this name is not one
a by-reference capture returned or stored in a fieldteko: a lambda that captures by reference cannot leave its scope
a lambda written against a delegate declared below itteko: a delegate declared below `new` is not taught yet

Arrays #

writtenmessage
T[][], or any multidimensional arrayteko: an array of arrays is not taught yet
a fixed array of a class or struct typeteko: an array of objects is not taught yet; use a field array or wait for T[]
reading a ref T[] / out T[] inside the calleeexpression with no codegen, from the core — the parameter carries the caller's slot, and the array is not reachable through it
.Length on a global fixed arrayteko: unknown member: Length — a local fixed array and any T[] answer
an index whose base is not an array the parse can nameteko: `[` needs an array
an inline array field by its bare name``teko: an array field is reached through `this.```
an inline array field of a type declared belowteko: an array field on a type declared below is not taught yet
a heap array as the element of another heap arraynot taught
a foreach over a global array, or over a forward-declared sourceteko: not a known array

A run-time index into a fixed array is not guarded; every index into a T[] is (arrays.md).

Namespaces and order of declaration #

writtenmessage
a nested namespaceteko: a nested namespace is not taught
using X = A.B; / using staticnot taught
a bare namespaced const as a case label (under a using)teko: a case label must be a constant expression — the qualified form (geo.N) does resolve
a global, an extern or main inside a namespace blockteko: a global is declared outside every namespace, and its two siblings
a qualified base or interface declared below its useteko: unknown base class or interface
a base class in another namespace, declared belowthe same
a type used above an #include "x.tk" that declares itexpected ; after expression, from the core — the forward scan does not read across a raw #include, so the name is not a type there; use import

Parameters and calls #

writtenmessage
params on a method, a constructor, an interface signature or a delegateteko: `params` is taught on a free function only
params not last, or two of themteko: `params` must be the last parameter, and there is only one
params over anything but a T[] (params xs, params i64 xs)``teko: params names an array type: write `params T[] xs```
params with ref/out, with a default, or on an externteko: a `params` list is not `ref` or `out```, teko: a params list has no default, teko: an extern symbol takes no params list``
params outside parameter positionteko: `params` declares a parameter list, nothing else
an argument that does not convert to the element typeteko: a value of type X does not convert to T — identity or derives/implements, an integer literal into any integer of the core, and an integer into a float (types.md)
two params lists of one name that a site cannot tell apart (params u8[] and params u64[] at f(1))teko: more than one overload of X matches these arguments
an integer argument on an overloaded name where no signature has an integer at that position (f(f64) beside f(uptr), at f(3))teko: no overload of X matches these arguments — the rounds do not search for the conversion; a name declared once converts
two overloads differing only by ref/out``teko: two overloads differ only by ref/`out```
a ref parameter repassed to an overloaded nameteko: the type of argument N of X is not known here
f(out i64 a) declaring the variable at the call sitenot taught: declare it first
a . on a receiver the parse cannot typeteko: the type of the left side of `.` is not known here
b.x += 1 on such a receiverthe same

switch #

writtenmessage
a type pattern in a caseteko: a case label must be a constant expression
a when on the textually last _ arm``teko: the last _ arm of a switch expression cannot carry a `when```
a switch expression with no _ armteko: a switch expression needs a `_` arm
control falling out of a non-empty caseteko: control cannot fall out of a case; end it with break

Dependency injection #

writtenmessage
a generic key (IRepo<T>)not taught
a keyed or named registration, a factory, a decorationnot taught
Services.Get<T>()there is no such surface: the form is a marker plus inject
an abstract class as a serviceteko: an abstract class is not a service
a service that is not a classteko: a service marker names a class
inject inside a lambdateko: inject inside a lambda takes the service from the enclosing scope; bind it outside and capture it with use (...)

The whole catalogue of messages, including the ones a well-formed program never sees, is diagnostics.md.

Edit this page