comp.lang.ada
 help / color / mirror / Atom feed
* Anyone who recognizes this errormsg?
@ 1996-04-10  0:00 Thorbergur Olafsson
  0 siblings, 0 replies; only message in thread
From: Thorbergur Olafsson @ 1996-04-10  0:00 UTC (permalink / raw)


Hi, I'm having problems comparing two own defined types with "=". When I compile the code
I get following error messages:

  mote_obj.adb:128:24: ambiguous expression (cannot resolve ""="")
  mote_obj.adb:128:24: possible interpretation at mote_obj.ads:32
  mote_obj.adb:128:24: possible interpretation at mote_obj.ads:54
  ... etc. with same errormsg. elsewhere.

The relevant code is :

-------------------------------
-- mote_obj.ads (MEETING_OBJ)--
-------------------------------

package mote_obj is
...
  type Time is tagged record
    Hour  : Hour_in_one_Day;
    Minut : Minutes_in_one_Hour;
  end record;

  type Date is tagged record
    Year  : Year_int;
    Month : Month_int;
    Day   : Day_int;
  end record;
...
  type MEETING_TYPE   is private;
  type MEETING_Start  is new Time with null record;
  type MEETING_Finish is new Time with null record;
  type MEETING_Date   is new Date with null record;
...
  function getStart ( M : MEETING_TYPE) return MEETING_Start;
  function getFinish( M : MEETING_TYPE) return MEETING_Finish;
  function getDate  ( M : MEETING_TYPE) return MEETING_Date;
...
  function "=" ( A, B : Time'Class) return Boolean; -- true if A = B
  function "=" ( A, B : Date'Class) return Boolean;
  function "=" ( A, B : MEETING_TYPE)return Boolean;
...

private
  type MEETING_TYPE is record
    StartTime : MEETING_Start;
    FinishTime: MEETING_Finish;
    Day       : MEETING_Date;
...
  end record;
...
end mote_obj;


-------------------------------
-- mote_obj.adb (MEETING_OBJ)--
-------------------------------

package body mote_obj is
...
  function getStart ( M : MEETING_TYPE ) return MEETING_Start is
  begin
    return M.StartTime;
  end getStart;

  function getFinish( M : MEETING_TYPE ) return MEETING_Finish is
  begin
    return M.FinishTime;
  end getFinish;

  function getDate( M : MEETING_TYPE ) return MEETING_Date is
  begin
    return M.Day;
  end getDate;
...
  function "="( A, B : Time'Class) return Boolean is		(2)
  begin
    return A.Hour = B.Hour and A.Minut = B.Minut;
  end "=";

  function "="( A, B : Date'Class) return Boolean is		(3)
  begin
    return A.Year = B.Year and A.Month = B.Month and A.Day = B.Day;
  end "=";
...
  function "=" ( A, B : MOTE_TYP) return Boolean is
  begin
    return getDate(A) = getDate(B) and			(1)
           getStart(A)= getStart(B) and			(1b)
           getFinish(A)=getFinish(B);			(1c)
  end "=";
...
end MOTE_OBJ;


(1) This is line 128 in the code and it is the "=" the compiler complains about. It also
  complains about the "=" in (1b) and (1c).

  (1) calls (att least should call) (3)
  (1b) and (1c) call (2).

--
Is there anyone who knows what is wrong here or is there anyone who recognizes this.

Answer appreciated both to newsgroups and through e-mail.

Thanx in advance!




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-04-10  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-10  0:00 Anyone who recognizes this errormsg? Thorbergur Olafsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox