Feature #144

ABS Type checker does not recognise subtypes

Added by Volker Stolz almost 5 years ago. Updated over 4 years ago.

Status:ClosedStart date:2014-03-14
Priority:NormalDue date:
Assignee:Volker Stolz% Done:

0%

Category:Compiler infrastructureSpent time:-
Target version:-

Description

[Migrating old HATS Trac #331: https://trac.hats-project.eu/projects/ABSTools/ticket/331 ]

The ABS type checker does not type check the following ABS model:

module X;

interface A { }
interface B extends A { }
class C implements B { }

{
    B b = new C();
    List<A> bs = Cons(b,Nil);
}

It returns the following error:

x.abs:9:2:Cannot assign ABS.StdLib.List<B> to type ABS.StdLib.List<A>.
    List<A> bs = Cons(b,Nil);
----^

I stumbled across this when trying to use Futures as the "container". After discussion with Martin, we both feel that for data types (in the functional part where no writes occur) it's safe.

History

#1 Updated by Volker Stolz over 4 years ago

  • Status changed from New to Resolved

#2 Updated by Volker Stolz over 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF