From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 3B79C386F009 for ; Wed, 10 Feb 2021 16:39:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3B79C386F009 Received: by mail-ed1-x535.google.com with SMTP id g10so3803155eds.2 for ; Wed, 10 Feb 2021 08:39:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=0Vg3RJg+uWn0SiWfWsp85HSlccLJRP5Zzj4WGA7mSFo=; b=LSpuN2RxAjdztjglZFHjVy6I+v858gWKR+6Rl+xNL/Mmtkd1Uu3j0MqjtAKO/JIAzc 7d4T6fTzrTkdsDG/uxG6swDzjm0BUn3AuG3+JJRJac0pmi2SFcPM/JFydaRlBKMMBTTf Hq5aazP+yXq5NBNHYqto8gQptjEpXj7Wror4ic0u21liNeZAd9rNKrgVy2w1AS9l1lj4 yzE5Ed0t+IIENN3Q5Exn+Ag7vdLJLrD9ou/PL2aZUWJhevl7EUdewk9MI5U8CroS7HSi kL5s32fwfSAjF+xCZswcmDqs2W9OBDMTOh6VO5To7CxlXpxOe/O/55E1Wh5roANOHb2t fGKg== X-Gm-Message-State: AOAM531Devr518Pf8K/3B1dWrS9LNaOHqaIfFZKMNcF55T2xIcH/iZ8Y YEwGYQ996JKPyR+8BJZxZMLuVd1IWQ0XQknZYhr366OtdnA= X-Google-Smtp-Source: ABdhPJzWMCwpiOvXyjNAmnc5+XfbzD38vXtl/3aHYltKPJ1I54XgiPDpjfAUWD4BOsbSJRyenjiYviB4skH7299UoFM= X-Received: by 2002:a50:8a90:: with SMTP id j16mr3866440edj.334.1612975149267; Wed, 10 Feb 2021 08:39:09 -0800 (PST) MIME-Version: 1.0 References: <9a702bae-a8f6-1dbf-dc27-b5c0702f4219@bothner.com> In-Reply-To: From: "J. Vincent Toups" Date: Wed, 10 Feb 2021 11:38:58 -0500 Message-ID: Subject: Fwd: Value of given type cannot be case to its own type. To: kawa@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2021 16:39:11 -0000 ---------- Forwarded message --------- From: J. Vincent Toups Date: Wed, Feb 10, 2021 at 10:42 AM Subject: Re: Value of given type cannot be case to its own type. To: Per Bothner I figured it out, actually. This may be something people new to Kawa experience from time to time so its worth describing here, I guess: The issue was that I had defined a class called mecs in lib and there was also a library called mecs in lib. So there were two classes lying around called lib.mecs. It makes sense in retrospect but I wonder if it might not also make sense to indicate in the class name of a library that it is produced by a define-library form rather than a class definition to prevent such classes in most cases. On Wed, Feb 10, 2021 at 10:36 AM Per Bothner wrote: > > On 2/10/21 7:12 AM, J. Vincent Toups via Kawa wrote: > > I'm seeing this error: > > > > Value 'lib.mecs@131a7516' for variable 'm' has wrong type (lib.mecs) > > (lib.mecs cannot be cast to lib.mecs) > > > > Which on the face of things is kind of flabbergasting. The specific > > line of code which causes the issue suggests that it is indeed the > > case that the value lib.mecs@etc... is a lib.mecs instance and its > > being used as a lib.mecs instance. > > We cannot possibly diagnose this without a test-case. > > There are various possibilities. The one that first comes to mind is a > class-loader problem: There are two classes named lib.mecs, loaded using > two different classloaders, and thus they are incompatible. Though that > would be more likely to show up at run-time rather than compile-time. > > It is also possible that one of the "lib.mecs" is not a reference to > an instance of the lib.mecs class (which would normally be the case), but > some type that the Kawa compiler displays as lib.mecs. Off-hand I can't > think of what that could be, but I would not be surprised to see that. > This could be a Kawa bug, of course. > -- > --Per Bothner > per@bothner.com http://per.bothner.com/