2002-01-24 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
index 55828e03b01b4361b1fbee5e2e83508de4d1a492..6c50c25cd1427142d8701be233c3ab3c596b8322 100755 (executable)
@@ -1,3 +1,660 @@
+2002-01-24  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (Invocation.EmitCall): Remove chunk of buggy
+       code.  We should not use force into static mode if the method is
+       not virtual.  Fixes bug in MIS
+
+       * statement.cs (Do.Emit, While.Emit, For.Emit,
+       Statement.EmitBoolExpression): Add support to Do and While to
+       propagate infinite loop as `I do return' semantics.
+
+       Improve the For case to also test for boolean constants.
+
+       * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
+       to the list of attributes we can add.
+
+       Remove `EmitContext' argument.
+
+       * class.cs (Method.Define): Apply parameter attributes.
+       (Constructor.Define): Apply parameter attributes.
+       (MethodCore.LabelParameters): Move here the core of labeling
+       parameters. 
+
+       * support.cs (ReflectionParameters.ParameterModifier,
+       InternalParameters.ParameterModifier): Use IsByRef on the type and
+       only return the OUT bit for these parameters instead of in/out/ref
+       flags.
+
+       This is because I miss-understood things.  The ParameterInfo.IsIn
+       and IsOut represent whether the parameter has the [In] and [Out]
+       attributes set.  
+
+2002-01-22  Miguel de Icaza  <miguel@ximian.com>
+
+       * ecore.cs (FieldExpr.Emit): Release temporaries.
+
+       * assign.cs (LocalTemporary.Release): new function.
+
+       * codegen.cs (EmitContext.GetTemporaryStorage,
+       EmitContext.FreeTemporaryStorage): Rework the way we deal with
+       temporary storage.  Now we can "put back" localbuilders when we
+       are done with them
+
+2002-01-21  Miguel de Icaza  <miguel@ximian.com>
+
+       * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
+       need to make a copy of the variable to generate verifiable code.
+
+2002-01-19  Miguel de Icaza  <miguel@ximian.com>
+
+       * driver.cs: Compute dynamically the system directory.
+
+       * ecore.cs (CopyNewMethods): reworked, exposed, made public.
+       Slower, but more generally useful.  Used by the abstract
+       registering implementation. 
+
+       * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
+       the rules for the special rule on Type/instances.  First check if
+       we have the same name, and if so, try that special static path
+       rather than the instance path.
+       
+2002-01-18  Miguel de Icaza  <miguel@ximian.com>
+
+       * cs-parser.jay: Emit 642 (warning: possible empty statement) for
+       for, while and if.
+
+       * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
+       Enum, ValueType, Delegate or Array for non-corlib compiles.
+
+       * cs-tokenizer.cs: Catch long identifiers (645)
+
+       * typemanager.cs (IndexerPropetyName): Ravi never tested this
+       piece of code.
+
+       * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
+       fix, we were returning too early, so we were not registering
+       pending methods from abstract classes.
+
+       Do not register pending methods if the class is abstract.
+
+       * expression.cs (Conditional.DoResolve): Report circular implicit
+       conversions when we neecd to compute it for conditional
+       expressions. 
+
+       (Is.DoResolve): If the expression is always of the provided type,
+       flag warning 183.  If the expression can not ever be of the
+       provided type flag warning 184.
+
+       * class.cs: Catch 169 as well.
+
+       * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
+       read. 
+
+2002-01-18  Nick Drochak  <ndrochak@gol.com>
+
+       * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
+
+2002-01-17  Miguel de Icaza  <miguel@ximian.com>
+
+       * interface.cs: (PopulateMethod): Check for pointers being defined
+       only if the unsafe context is active.
+       (PopulateProperty): ditto.
+       (PopulateIndexer): ditto.
+
+       * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
+       specified.  If pointers are present, make sure that they are
+       present in an unsafe context.
+       (Constructor, Constructor.Define): ditto.
+       (Field, Field.Define): ditto.
+       (Property, Property.Define): ditto.
+       (Event, Event.Define): ditto.
+
+       * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
+       hashtable if there are classes or structs defined.
+
+       * expression.cs (LocalVariableReference.DoResolve): Simplify this
+       code, as the constant resolution moved.
+
+       * statement.cs (Block.EmitMeta): Resolve all constants as we emit
+       the metadata, so we can flag error 133. 
+
+       * decl.cs (MemberCore.UnsafeOK): New function to test that a
+       pointer is being declared in an unsafe context.
+
+2002-01-16  Miguel de Icaza  <miguel@ximian.com>
+
+       * modifiers.cs (Modifiers.Check): Require a Location argument.
+       Report error 227 for Unsafe use.
+
+       * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
+
+       * statement.cs (For.Emit): If the test is null, then report that
+       we do `return', as we wont reach anything afterwards.
+
+       (Switch.SwitchGoverningType): Track the expression that matched
+       the conversion.
+
+       * driver.cs: Allow negative numbers as an error code to flag.
+
+       * cs-parser.jay: Handle 1551.
+
+       * namespace.cs: Add 1537 checking (repeated using alias namespaces).
+
+2002-01-15  Miguel de Icaza  <miguel@ximian.com>
+
+       * cs-parser.jay: Report 1518 (type declaration can only contain
+       class, struct, interface, enum or delegate)
+
+       (switch_label): Report 1523 (keywords `case' or `default' must
+       preced code)
+
+       (opt_switch_sections): Report 1522 (empty switch)
+
+       * driver.cs: Report 1515 (response file specified multiple times)
+       Report 1516 (Source file specified multiple times).
+
+       * expression.cs (Argument.Resolve): Signal 1510
+
+       (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
+       access not allowed in static code)
+
+2002-01-11  Ravi Pratap  <ravi@ximian.com>
+
+       * typemanager.cs (IsPointerType): Utility method which we are going
+       to need a lot.
+
+       * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
+       the object type, so we take care of that.
+
+       * expression.cs (FullMethodDesc): Also include the return type in descriptions.
+       
+       * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
+       added to non-params parameters :-)
+
+       * typemanager.cs (CSharpName): Include 'void' type too. 
+
+       (void_ptr_type): Include in the set of core types.
+
+       * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
+       duplicating code.
+
+       (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
+       an unsafe context.
+
+       * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
+       completely forgotten about it.
+
+2002-01-10  Ravi Pratap  <ravi@ximian.com>
+
+       * cs-parser.jay (pointer_type): Add. This begins our implementation
+       of parsing rules for unsafe code.
+
+       (unsafe_statement): Implement.
+
+       (embedded_statement): Modify to include the above.
+
+       * statement.cs (Unsafe): Implement new class for unsafe blocks.
+
+       * codegen.cs (EmitContext.InUnsafe): Add. This determines
+       if the current context is an unsafe one.
+
+       * cs-parser.jay (local_variable_pointer_type): Since local variable types
+       are handled differently, we need separate rules for them.
+
+       (local_variable_declaration): Update to use local_variable_pointer_type
+       to allow variable declarations of unmanaged pointer types.
+
+       * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
+       in unsafe contexts.
+
+       * ../errors/cs0214.cs : Add.
+
+2002-01-16  Nick Drochak  <ndrochak@gol.com>
+
+       * makefile: remove 'response' file when cleaning.
+
+2002-01-15  Miguel de Icaza  <miguel@ximian.com>
+
+       * cs-parser.jay: Report 1524.
+
+2002-01-14  Miguel de Icaza  <miguel@ximian.com>
+
+       * typemanager.cs (RegisterMethod): drop checking if we have
+       registered this from here
+
+2002-01-12  Miguel de Icaza  <miguel@ximian.com>
+
+       * class.cs (Method.EmitDestructor): Implement calling our base
+       destructor. 
+
+       * statement.cs (Try.Emit): Fix to reset the InFinally to the old
+       value of InFinally.
+
+       * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
+       this routine and will wrap the call in a try/catch block.  Deal
+       with the case.
+
+2002-01-11  Miguel de Icaza  <miguel@ximian.com>
+
+       * ecore.cs (Expression.MemberLookup): instead of taking a
+       parameter `same_type' that was used to tell whether we could
+       access private members we compute our containing type from the
+       EmitContext.
+
+       (FieldExpr): Added partial support for volatile fields.  This does
+       not work for volatile fields exposed from assemblies, as I can not
+       figure out how to extract the modreq from it.
+
+       Updated all the source files to use this.
+
+       * codegen.cs (EmitContext): Compute ContainerType ahead of time,
+       because it is referenced by MemberLookup very often. 
+
+2002-01-09  Ravi Pratap  <ravi@ximian.com>
+
+       * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
+       TypeBuilder.GetCustomAttributes to retrieve what we need.
+
+       Get rid of redundant default_member_attr_type as this is the same as
+       default_member_type which already exists.
+
+       * interface.cs, attribute.cs : Update accordingly.
+       
+2002-01-08  Miguel de Icaza  <miguel@ximian.com>
+
+       * typemanager.cs: Enable IndexerPropertyName again.  It does not
+       work for TYpeBuilders though.  Ravi, can you please fix this?
+
+       * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
+
+       * expression.cs (Argument.Emit): Handle the case of ref objects
+       being passed to ref functions;  
+
+       (ParameterReference.EmitLoad): Loads the content of the pointer
+       without dereferencing.
+
+2002-01-07  Miguel de Icaza  <miguel@ximian.com>
+
+       * cs-tokenizer.cs: Implemented the pre-processing expressions.
+
+2002-01-08  Ravi Pratap  <ravi@ximian.com>
+
+       * class.cs (Indexer.DefineMethod): Incorporate the interface
+       type in the name of the method if we are doing explicit interface
+       implementation.
+
+       * expression.cs (ConversionExists): Remove as it is completely obsolete.
+
+       (BetterConversion): Fix extremely trivial bug where we were referring to
+       ConversionExists instead of StandardConversionExists ! Hooray, things are fine
+       again !
+
+       * ../errors/bug16.cs : Add although we have fixed it.
+
+2002-01-07  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (BaseIndexer): Begin implementation.
+
+       * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
+
+       * cs-parser.jay (indexer_declarator): Use qualified_identifier
+       production directly to remove a shift/reduce, and implement
+       explicit interface implementation.
+
+       * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
+       after a floating point suffix.
+
+       * expression.cs (DoNumericPromotions): Improved the conversion for
+       uint/uint.  If we have a constant, we avoid doing a typecast to a
+       larger type.
+
+       * class.cs (Indexer): Implement explicit interface implementation
+       for indexers.
+       
+Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+       * class.cs: make the default instance constructor public and hidebysig.
+
+2001-01-03  Ravi Pratap  <ravi@ximian.com>
+
+       * interface.cs (EmitDefaultMemberAttr): Make this helper method static
+       so we can call it from elsewhere.
+
+       * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
+       we emit it internally if the class has a defined indexer; otherwise the user
+       emits it by decorating the class definition with the DefaultMemberAttribute.
+
+       * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
+       attribute is not used on a type which defines an indexer.
+
+       * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
+       character when we skip whitespace.
+
+       * ../errors/cs0646.cs : Add.
+
+2002-01-03  Miguel de Icaza  <miguel@ximian.com>
+
+       * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
+       again. 
+
+       * makefile: Add practical target `mcs3.exe' which builds the third
+       generation compiler. 
+
+       * expression.cs (New): Fix structures constructor calling.
+
+       * class.cs (Property, Method, Indexer): Emit Final flag on the
+       method if we are an interface implementation and we are not
+       abstract. 
+
+       * ecore.cs (PropertyExpr): New public field `IsBase', tells
+       whether this property is referencing a `base' method.
+
+       * expression.cs (Invocation.EmitCall): take an extra argument:
+       is_base, this is used to determine whether the `call' or
+       `callvirt' opcode should be used.
+
+       
+       * delegate.cs: update EmitCall.
+
+       * class.cs (Method.Define): Set NewSlot for the cases where we are
+       not implementing an interface method.
+
+       (Property.Define): ditto.
+
+2002-01-02  Miguel de Icaza  <miguel@ximian.com>
+
+       * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
+       'r'.  Allows mcs to parse itself fully.
+
+2002-01-02  Ravi Pratap  <ravi@ximian.com>
+
+       * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
+       of the number of initializers that require the InitializeArray method.
+
+       (CheckIndices): Store the Expression in all cases - not the plain value. Also
+       update the above field where necessary.
+
+       (MakeByteBlob): Update accordingly.
+
+       (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
+       greater than 2.
+
+       (EmitDynamicInitializers): Update in accordance with the new optimization.
+
+       (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
+       same OpCode applies.
+
+       * cs-parser.jay : Fix some glaring errors I introduced.
+
+2002-01-01  Ravi Pratap  <ravi@ximian.com> 
+
+       * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
+       so that we can check for name clashes there too.
+
+       * typemanager.cs (default_member_attr_type): The attribute that we need to emit
+       for interface indexers.
+
+       * interfaces.cs (Define): Emit the default member attribute.
+
+       * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
+       variable was being referred to while setting the value ;-)
+
+2002-01-01  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (MakeByteBlob): Optimize: we do not need to fill
+       byte-by-byte information when we know the data is zero.
+
+       Make the block always a multiple of 4, because
+       DefineInitializedData has a bug.
+
+       * assign.cs: Fix, we should assign from the temporary, not from
+       the source. 
+
+       * expression.cs (MakeByteBlob): Fix my incorrect code.
+
+2001-12-31  Miguel de Icaza  <miguel@ximian.com>
+
+       * typemanager.cs (EnumToUnderlying): This function is used to get
+       the underlying type from an enumeration, because it does not
+       always work. 
+
+       * constant.cs: Use the I4_S form for values between -128 and 127.
+
+       * statement.cs (Block.LookupLabel): Looks up a label.
+       (Block): Drop support for labeled blocks.
+
+       (LabeledStatement): New kind of statement that represents a label
+       only.
+
+       (Goto): Finally implement this bad boy.
+       
+       * cs-parser.jay: Update to reflect new mechanism to implement
+       labels.
+
+2001-12-30  Miguel de Icaza  <miguel@ximian.com>
+
+       * codegen.cs (EmitContext.This): a codegen property that keeps the
+       a single instance of this instead of creating many different this
+       instances. 
+
+       * delegate.cs (Delegate.DoResolve): Update to use the property;
+
+       * ecore.cs (SimpleName.SimpleNameResolve): Ditto
+
+       * expression.cs (BaseAccess.DoResolve): Ditto.
+
+2001-12-29  Ravi Pratap  <ravi@ximian.com>
+
+       * typemanager.cs (methodimpl_attr_type): Add to hold the type
+       corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
+
+       (InitCoreTypes): Update accordingly.
+
+       * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
+       so we can quickly store the state.
+
+       (ApplyAttributes): Set the correct implementation flags
+       for InternalCall methods.
+
+2001-12-29  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (EmitCall): if a method is not virtual, then do
+       not use callvirt on it.
+
+       (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
+       user defined stuff) requires the use of stobj, which takes an
+       address on the stack instead of an array and an index.  So emit
+       the Ldelema operation for it.
+
+       (EmitStoreOpcode): Use stobj for valuetypes.
+
+       (UnaryMutator.EmitCode): Use the right 1 value depending on
+       whether we are dealing with int64/uint64, float or doubles.
+
+       * class.cs (TypeContainer.AddConstructor): Fix the logic to define
+       constructors that I implemented last night.
+
+       (Constructor.IsDefault): Fix to work properly for static
+       constructors.
+
+       * cs-parser.jay (CheckDef): report method signature errors.
+       Update error number 103 to be 132.
+
+       * decl.cs: New AdditionResult enumeration value: MethodExists.
+       Although we do this check for methods later on in the semantic
+       analysis, catching repeated default constructors is so easy that
+       we catch these here. 
+       
+       * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
+       promotions code.
+
+       (ParameterReference.EmitAssign, Emit): handle
+       bools as bytes.
+
+       (ArrayAccess.EmitLoadOpcode): Handle bool type here.
+       (ArrayAccess.EmitStoreOpcode): ditto.
+
+       * cs-tokenizer.cs (is_punct): Eliminated empty computation.
+
+       * expression.cs (MakeByteBlob): Complete all the missing types
+       (uint, short, ushort, byte, sbyte)
+
+       * class.cs: Only init instance field initializers on instance
+       constructors. 
+
+       Rename `constructors' to instance_constructors. 
+
+       (TypeContainer.AddConstructor): Only add constructors to the list
+       if it is not static.
+
+       Make sure that we handle default_static_constructor independently
+       everywhere where we handle instance_constructors
+
+2001-12-28  Miguel de Icaza  <miguel@ximian.com>
+
+       * class.cs: Do not lookup or create a base initializer for a
+       static constructor.
+
+       (ConstructorInitializer.Resolve): use the proper type to lookup
+       for constructors.
+
+       * cs-parser.jay: Report error 1585 (modifiers between type and name).
+
+       * enum.cs, interface.cs: Remove CloseType, this is taken care by
+       in DeclSpace. 
+
+       * decl.cs: CloseType is now an virtual method, the default
+       implementation just closes this type.
+       
+2001-12-28  Ravi Pratap  <ravi@ximian.com>
+
+       * attribute.cs (DefinePInvokeMethod): Set the implementation flags
+       to PreserveSig by default. Also emit HideBySig on such methods.
+
+       Basically, set the defaults to standard values.
+
+       * expression.cs (Invocation.BetterFunction): We need to make sure that for each
+       argument, if candidate is better, it can't be worse than the best !
+
+       (Invocation): Re-write bits to differentiate between methods being
+       applicable in their expanded form and their normal form - for params
+       methods of course.
+
+       Get rid of use_standard everywhere as only standard conversions are allowed
+       in overload resolution. 
+
+       More spec conformance.
+       
+2001-12-27  Miguel de Icaza  <miguel@ximian.com>
+
+       * driver.cs: Add --timestamp, to see where the compiler spends
+       most of its time.
+
+       * ecore.cs (SimpleName.DoResolve): Do not create an implicit
+       `this' in static code.
+
+       (SimpleName.DoResolve): Implement in terms of a helper function
+       that allows static-references to be passed upstream to
+       MemberAccess.
+
+       (Expression.ResolveWithSimpleName): Resolve specially simple
+       names when called by MemberAccess to implement the special
+       semantics. 
+
+       (Expression.ImplicitReferenceConversion): Handle conversions from
+       Null to reference types before others, as Null's type is
+       System.Object. 
+
+       * expression.cs (Invocation.EmitCall): Handle the special case of
+       calling methods declared on a reference type from a ValueType
+       (Base classes System.Object and System.Enum)
+
+       (MemberAccess.Resolve): Only perform lookups on Enumerations if
+       the left hand side is a TypeExpr, not on every enumeration. 
+
+       (Binary.Resolve): If types are reference types, then do a cast to
+       object on operators != and == of both arguments.
+       
+       * typemanager.cs (FindMembers): Extract instance and static
+       members if requested.
+
+       * interface.cs (PopulateProperty): Use void_type instead of null
+       as the return type for the setter method.
+
+       (PopulateIndexer): ditto.
+
+2001-12-27  Ravi Pratap  <ravi@ximian.com>
+
+       * support.cs (ReflectionParameters): Fix minor bug where we
+       were examining the wrong parameter for the ParamArray attribute.
+
+       Cope with requests for the type of the parameter at position
+       greater than the params parameter's. We now return the element
+       type of the params array as that makes more sense.
+
+       * expression.cs (Invocation.IsParamsMethodApplicable): Update 
+       accordingly as we no longer have to extract the element type
+       ourselves.
+
+       (Invocation.OverloadResolve): Update.
+
+2001-12-27  Miguel de Icaza  <miguel@ximian.com>
+
+       * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
+       against IEnumerator, test whether the return value is a descendant
+       of the IEnumerator interface.
+
+       * class.cs (Indexer.Define): Use an auxiliary method to implement
+       the other bits of the method definition.  Begin support for
+       explicit interface implementation.
+
+       (Property.DefineMethod): Use TypeManager.void_type instead of null
+       for an empty return value.
+
+2001-12-26  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (MemberAccess.ResolveMemberAccess): if we are
+       dealing with a FieldExpr which is composed of a FieldBuilder, in
+       the code path we did extract the constant, but we should have
+       obtained the underlying value to be able to cast it (otherwise we
+       end up in an infinite loop, this is what Ravi was running into).
+
+       (ArrayCreation.UpdateIndices): Arrays might be empty.
+
+       (MemberAccess.ResolveMemberAccess): Add support for section
+       14.5.4.1 that deals with the special case of E.I when E is a type
+       and something else, that I can be a reference to a static member.
+
+       (ArrayCreation.MakeByteBlob): It is not an error to not be able to
+       handle a particular array type to create byte blobs, it is just
+       something we dont generate byteblobs for.
+
+       * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
+       arguments. 
+
+       * location.cs (Push): remove the key from the hashtable that we
+       are about to add.   This happens for empty files.
+
+       * driver.cs: Dispose files after we have parsed them.
+
+       (tokenize): new function that only runs the tokenizer on its
+       input, for speed testing.
+
+2001-12-26  Ravi Pratap  <ravi@ximian.com>
+
+       * class.cs (Event.Define): Define the private field only if there
+       are no accessors defined.
+
+       * expression.cs (ResolveMemberAccess): If there is no associated
+       field with the event, that means we have an event defined with its
+       own accessors and we should flag error cs0070 since transforming
+       ourselves into a field is not valid in that case.
+
+       * ecore.cs (SimpleName.DoResolve): Same as above.
+
+       * attribute.cs (DefinePInvokeMethod): Set the default calling convention
+       and charset to sane values.
+
 2001-12-25  Ravi Pratap  <ravi@ximian.com>
 
        * assign.cs (DoResolve): Perform check on events only if they