2003-05-28 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
index f9598092990a36661e9ab4e71359276cf851709e..85b3686a988f04c3c8df508d8e22185dbf67a429 100755 (executable)
@@ -1,6 +1,489 @@
+2003-05-28  Miguel de Icaza  <miguel@ximian.com>
+
+       * cs-parser.jay: Update grammar to include anonymous methods.
+       
+       * anonymous.cs: new file.
+
+2003-05-27  Miguel de Icaza  <miguel@ximian.com>
+
+       * class.cs (Field.Define): Add missing test for pointers and
+       safety. 
+
+2003-05-27  Ravi Pratap  <ravi@ximian.com>
+
+       * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
+       we use the stobj opcode.
+
+       (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
+       since it wasn't the correct fix. 
+
+       It still is puzzling that we are required to use stobj for IntPtr
+       which seems to be a ValueType.
+
+2003-05-26  Miguel de Icaza  <miguel@ximian.com>
+
+       * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
+       during regular simple name resolution.   Now, the trick is that
+       instead of returning for processing the simplename, we do a
+       TypeManager.LookupType (ie, a rooted lookup as opposed to a
+       contextual lookup type).   If a match is found, return that, if
+       not, return for further composition.
+
+       This fixes long-standing 30485.
+
+       * expression.cs (ArrayCreation.EmitDynamicInitializers): When
+       using the address to initialize an object, do an Stobj instead of
+       using the regular Stelem.
+
+       (IndexerAccess.Emit, IndexerAccess.EmitAssign):
+       Pass `is_base_indexer' to Invocation.EmitCall instead of false.
+       Because if we are a BaseIndexerAccess that value will be true.
+       Fixes 43643.
+
+       * statement.cs (GotoCase.Resolve): Return after reporting an
+       error, do not attempt to continue. 
+
+       * expression.cs (PointerArithmetic.Emit): If our operand is a
+       long, convert our constants to match the operand before
+       multiplying.  Convert to I type before adding.   Fixes 43670.
+       
+2003-05-14  Ravi Pratap  <ravi@ximian.com>
+
+       * enum.cs (ImplicitConversionExists) : Rename to
+       ImplicitEnumConversionExists to remove ambiguity. 
+
+       * ecore.cs (NullCast): New type of cast expression class which
+       basically is very similar to EmptyCast with the difference being
+       it still is a constant since it is used only to cast a null to
+       something else
+       (eg. (string) null)
+
+       * convert.cs (ImplicitReferenceConversion): When casting a null
+       literal, we return a NullCast.
+
+       * literal.cs (NullLiteralTyped): Remove - I don't see why this
+       should be around anymore.
+
+       The renaming (reported was slightly wrong). Corrections:
+
+       ConvertImplicitStandard -> ImplicitConversionStandard
+       ConvertExplicitStandard -> ExplicitConversionStandard
+
+       * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
+       before passing them in !
+
+       * convert.cs (ImplicitConversionStandard): When comparing for
+       equal expr and target types, ensure that expr is not a
+       NullLiteral.
+
+       In general, we must not be checking (expr_type ==
+       target_type) in the top level conversion methods
+       (ImplicitConversion, ExplicitConversion etc). This checking is
+       done in the methods that they delegate to.
+
+2003-05-20  Miguel de Icaza  <miguel@ximian.com>
+
+       * convert.cs: Move Error_CannotConvertType,
+       ImplicitReferenceConversion, ImplicitReferenceConversionExists,
+       ImplicitNumericConversion, ImplicitConversionExists,
+       ImplicitUserConversionExists, StandardConversionExists,
+       FindMostEncompassedType, FindMostSpecificSource,
+       FindMostSpecificTarget, ImplicitUserConversion,
+       ExplicitUserConversion, GetConversionOperators,
+       UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
+       TryImplicitIntConversion, Error_CannotConvertImplicit,
+       ConvertImplicitRequired, ConvertNumericExplicit,
+       ExplicitReferenceConversionExists, ConvertReferenceExplicit,
+       ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
+       its own file.
+
+       Perform the following renames:
+       
+       StandardConversionExists -> ImplicitStandardConversionExists
+       ConvertImplicit -> ImplicitConversion
+        ConvertImplicitStandard -> ImplicitStandardConversion
+        TryImplicitIntConversion -> ImplicitIntConversion
+        ConvertImplicitRequired -> ImplicitConversionRequired
+        ConvertNumericExplicit -> ExplicitNumericConversion
+        ConvertReferenceExplicit -> ExplicitReferenceConversion
+        ConvertExplicit -> ExplicitConversion
+        ConvertExplicitStandard -> ExplicitStandardConversion
+
+2003-05-19  Martin Baulig  <martin@ximian.com>
+
+       * statement.cs (TypeInfo.StructInfo): Made this type protected.
+       (TypeInfo): Added support for structs having structs as fields.
+
+       * ecore.cs (FieldExpr): Implement IVariable.
+       (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
+       VariableInfo for the field.
+
+2003-05-18  Martin Baulig  <martin@ximian.com>
+
+       * expression.cs (This.DoResolve): Report a CS0027 if we're
+       emitting a field initializer.
+
+2003-05-18  Martin Baulig  <martin@ximian.com>
+
+       * expression.cs (This.ResolveBase): New public function.
+       (This.DoResolve): Check for CS0188.
+
+       * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
+       This.Resolve().
+
+       * ecore.cs (MethodGroupExpr.DoResolve): Set the
+       `instance_expression' to null if we don't have any non-static
+       methods.
+
+2003-05-18  Martin Baulig  <martin@ximian.com>
+
+       Reworked the way how local variables and parameters are handled by
+       the flow analysis code.
+
+       * statement.cs (TypeInfo, VariableMap): New public classes.
+       (VariableInfo): New public class.  This is now responsible for
+       checking whether a variable has been assigned.  It is used for
+       parameters and local variables.
+       (Block.EmitMeta): Take the InternalParameters as argument; compute
+       the layout of the flow vectors here.
+       (Block.LocalMap, Block.ParameterMap): New public properties.
+       (FlowBranching): The .ctor doesn't get the InternalParameters
+       anymore since Block.EmitMeta() now computes the layout of the flow
+       vector.
+       (MyStructInfo): This class is now known as `StructInfo' and nested
+       in `TypeInfo'; we don't access this directly anymore.
+
+       * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
+       property and removed IsAssigned(), IsFieldAssigned(),
+       SetAssigned() and SetFieldAssigned(); we now call them on the
+       VariableInfo so we don't need to duplicate this code everywhere.
+
+       * expression.cs (ParameterReference): Added `Block block' argument
+       to the .ctor.
+       (LocalVariableReference, ParameterReference, This): The new
+       VariableInfo class is now responsible for all the definite
+       assignment stuff.
+
+       * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
+       IsParameterAssigned, SetParameterAssigned): Removed.
+
+2003-05-18  Martin Baulig  <martin@ximian.com>
+
+       * typemanager.cs (InitCoreTypes): Try calling
+       SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
+       the 3-args-version.  Corlib now also needs our `void_type'.
+       (GetMethod): Added overloaded version which takes an optional
+       `bool report_errors' to allow lookups of optional methods.
+
+2003-05-12  Martin Baulig  <martin@ximian.com>
+
+       * statement.cs (VariableInfo): Renamed to LocalInfo since it's
+       only used for locals and not for parameters.
+
+2003-05-12  Miguel de Icaza  <miguel@ximian.com>
+
+       * support.cs (InternalParameters.ParameterType): Return the
+       ExternalType of the parameter.
+
+       * parameter.cs (Parameter.ExternalType): drop the two arguments,
+       they were unused.
+
+2003-05-11  Miguel de Icaza  <miguel@ximian.com>
+
+       * class.cs (MethodData.Define): Do not set the `newslot' on
+       interface members, if they are also flagged as "override".
+
+       * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
+       better code for ++i and i++.  This only works for static fields
+       and local variables.
+
+       * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
+       want to pull the DeclSpace out of the builder_to_declspace instead
+       of the TypeBuilder (like in TypeContainer.FindMembers).
+
+       * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
+       instead of LookupTypeContainer.  Fixes the crash on .NET for
+       looking up interface members.
+
+       * const.cs: Create our own emit context during the Definition
+       stage, so that constants are evaluated in the proper context, when
+       a recursive definition happens.
+
+2003-05-11  Martin Baulig  <martin@ximian.com>
+
+       * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
+       new block for a switch section.
+       (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
+       the adding/lookup in the switch block.  Fixes #39828.
+
+2003-05-09  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
+       functionality: I needed to convert the data after I had performed
+       the add/sub operation into the operands type size.
+
+       * ecore.cs (ImplicitReferenceConversion): When boxing an interface
+       pass the type for the box operation, otherwise the resulting
+       object would have been of type object.
+
+       (BoxedCast): Add constructor to specify the type to box as.
+
+2003-05-07  Miguel de Icaza  <miguel@ximian.com>
+
+       * iterators.cs: I was reusing the `count' variable inadvertently,
+       take steps to not allow this to happen.
+
+2003-05-06  Miguel de Icaza  <miguel@ximian.com>
+
+       * attribute.cs (Attribute.Resolve): Params attributes are encoded
+       by creating an array at the point where the params starts and
+       putting all those arguments there, then adjusting the size of the
+       array.
+
+2003-05-05  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (New.AddressOf): Implement interface
+       IMemoryLocation.  This is used when the `new' operator is used in
+       the context of an invocation to a method on a value type.
+
+       See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
+       example. 
+
+       * namespace.cs: Also check the using aliases here.
+
+       * driver.cs: Move the test for using validity after the types have
+       been entered, so we do a single pass that also includes the using
+       aliases. 
+
+       * statement.cs (Try.Resolve): Avoid crashing if there is a failure
+       in the regular case.   CreateSiblingForFinally is doing extra
+       error checking.
+
+       * attribute.cs (GetAttributeArgumentExpression): Store the result
+       on an out value, and use the return value to indicate failure
+       instead of using null (which is a valid return for Constant.GetValue).
+
+       * statement.cs: Perform the analysis flow for the increment
+       portion after the statement, because this will be the real flow of
+       execution.  Fixes #42385
+
+       * codegen.cs (EmitContext.EmitArgument,
+       EmitContext.EmitStoreArgument): New helper functions when the
+       RemapToProxy flag is set.
+
+       * expression.cs (ParameterReference.EmitLdarg): Expose this useful
+       function.
+
+       Add support for remapping parameters. 
+
+       * iterators.cs: Propagate parameter values;  Store parameter
+       values in the proxy classes.
+       
+2003-05-04  Miguel de Icaza  <miguel@ximian.com>
+
+       * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
+       need a proxy reference;  I do not know what I was thinking
+
+       * cs-parser.jay (constructor_initializer): catch another error,
+       and display nice message.
+       
+       (field_declaration): catch void field declaration
+       to flag a better error. 
+
+       * class.cs (MemberBase.CheckBase): Report an error instead of a
+       warning if a new protected member is declared in a struct. 
+       (Field.Define): catch the error of readonly/volatile.
+
+       * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
+
+       (FieldExpr.AddressOf): ditto.  Catch error where the address of a
+       volatile variable is taken
+
+2003-05-02  Miguel de Icaza  <miguel@ximian.com>
+
+       * statement.cs (Fixed.Resolve): Report an error if we are not in
+       an unsafe context.
+
+2003-05-01  Miguel de Icaza  <miguel@ximian.com>
+
+       * typemanager.cs: reuse the code that handles type clashes for
+       delegates and enumerations.
+
+       * class.cs (Report28): Always report.
+
+       * expression.cs (EncodeAsAttribute): Allow nulls here.
+
+2003-04-28  Miguel de Icaza  <miguel@ximian.com>
+
+       * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
+       the functionality for testing whether an expression is valid for
+       an attribute here.  Also handle the case of arrays of elements
+       being stored. 
+
+       * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
+       encoding a linear array into an array of objects that are suitable
+       to be passed to an CustomAttributeBuilder.
+
+       * delegate.cs: Check unsafe types being used outside of an Unsafe context.
+
+       * ecore.cs: (FieldExpr): Handle field remapping here.
+
+       * iteratators.cs: Pass the instance variable (if the method is an
+       instance method) to the constructors, so we can access the field
+       variables on the class.
+
+       TODO: Test this with structs.  I think the THIS variable on
+       structs might have to be a pointer, and not a refenrece
+
+2003-04-27  Miguel de Icaza  <miguel@ximian.com>
+
+       * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
+       local variables to fields in a proxy class.
+
+       * iterators.cs (PopulateProxy): Rename our internal fields to
+       <XXX>.  
+       Create a <THIS> field if we are an instance method, so we can
+       reference our parent container variables.
+       (MapVariable): Called back from the EmitContext code to enter a
+       new variable to field mapping into the proxy class (we just create
+       a FieldBuilder).
+
+       * expression.cs
+       (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
+       for using the remapped locals to fields.
+
+       I placed the code here, because that gives the same semantics to
+       local variables, and only changes the Emit code.
+
+       * statement.cs (Fixed.Resolve): it is not allowed to have fixed
+       statements inside iterators.
+       (VariableInfo): Add a FieldBuilder for the cases when we are
+       remapping local variables to fields in a proxy class
+
+       * ecore.cs (SimpleNameResolve): Avoid testing two times for
+       current_block != null.
+
+       * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
+       not cope with strings, as it has been moved to the
+       TableSwitchEmit.  Fixed bug in switch generation.
+
+       * expression.cs (New.DoResolve): Provide more context for the user
+       when reporting an error.
+
+       * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
+       pointers. 
+
+       * expression.cs (MemberAccess.DoResolve): When we get a type back,
+       check the permissions for it.  Note than in a type-resolution
+       context the check was already present in DeclSpace.ResolveType,
+       but was missing from the MemberAccess.
+
+       (ArrayCreation.CheckIndices): warn if the user has
+       more nested levels of expressions, but there are no more
+       dimensions specified.  Avoids crash on bug 41906.
+
+2003-04-26  Miguel de Icaza  <miguel@ximian.com>
+
+       * statement.cs (Block): replace Implicit bool, for a generic
+       flags.   
+       New flag: `Unchecked'.  This is used during the EmitMeta phase
+       (which is out-of-line with the regular Resolve/Emit process for a
+       statement, as this is done ahead of time, but still gets a chance
+       to call constant resolve).
+       
+       (Block.Flags): new enum for adding a new flag.
+
+       (Block.EmitMeta): track the state of unchecked.
+       
+       (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
+       to enable constant resolution to work there as well.
+
+2003-04-22  Miguel de Icaza  <miguel@ximian.com>
+
+       * typemanager.cs (ienumerable_type): Also look up
+       System.Collections.IEnumerable. 
+
+2003-04-21  Miguel de Icaza  <miguel@ximian.com>
+
+       TODO: Test more than one conditional per method.
+       
+       * class.cs (Indexer.Define): Report the location where the user is
+       referencing the unsupported feature.
+
+       (MethodData): Overload the use of `conditionals' to
+       minimize the creation of needless ArrayLists.   This saves roughly
+       212kb on my machine.
+
+       (Method): Implement the new IIteratorContainer interface.
+       (Method.SetYields): Implement the method by setting the ModFlags
+       to contain METHOD_YIELDS.
+       
+       * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
+       which just got set to null.
+
+       * iterators.cs: New file.
+
+       (Yield, YieldBreak): New statements.
+
+       * statement.cs (Return.Resolve): Flag an error if we are used in
+       an iterator method.
+
+       * codegen.cs (InIterator): New flag set if the code is being
+       compiled in an iterator method.
+
+       * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
+       internal modifier, and we just use it to avoid adding extra
+       fields, as this is seldom used.  
+
+       * cs-parser.jay: Add yield_statement (yield and yield break).
+
+       * driver.cs: New flag -v2 to turn on version 2 features. 
+
+       * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
+       hashtable when v2 is enabled.
+
 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
 
-       * driver.cs: Use CodePage not WindowsCodePage.
+       * typemanager.cs (TypeManager.NamespaceClash): Use to check if
+       there is already a namespace defined with this name.
+
+       (TypeManager.InitCoreTypes): Remove the temporary workaround, as
+       people upgraded their corlibs.
+
+       (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
+       always use fully qualified types, no need to use the compiler
+       front end.
+
+       (TypeManager.IsNamespace): Use binarysearch.
+       
+       * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
+       AddDelegate): I did not quite use the new IsValid API properly: I
+       have to pass the short-name and the fullname.  I was passing only
+       the basename instead of the fullname sometimes. 
+
+       (TypeContainer.DefineType): call NamespaceClash.
+
+       * interface.cs (Interface.DefineType): use NamespaceClash before
+       defining the type.
+
+       * delegate.cs (Delegate.DefineType): use NamespaceClash before
+       defining the type.
+
+       * enum.cs: (Enum.DefineType): use NamespaceClash before
+       defining the type.
+
+       * typemanager.cs (: 3-line patch that gives us some tasty 11%
+       speed increase.  First, use the negative_hits cache when we get a
+       negative.  Second, add the type with its full original name
+       instead of the new . and + encoded name (reflection uses + to
+       separate type from a nested type).  Use LookupTypeReflection
+       directly which bypasses the type->name hashtable (that we already
+       know does not contain the type.
+       
+       * decl.cs (DeclSpace.ResolveTypeExpr): track the
+       location/container type. 
+
+       * driver.cs: When passing utf8, use directly the UTF8Encoding.
 
 2003-04-19  Miguel de Icaza  <miguel@ximian.com>