PR# 19441 [er] Typing issue with empty manifest array
Problem Report Summary
Submitter: axarosenberg
Category: Compiler
Priority: High
Date: 2018/05/31
Class: Bug
Severity: Critical
Number: 19441
Release: 18.01
Confidential: No
Status: Open
Responsible:
Environment: win
Synopsis: [er] Typing issue with empty manifest array
Description
When I write code like that: ~~~~ local a: ARRAY [INTEGER] do a := <<{INTEGER_8} 1>> ~~~~ the compiler will create an ARRAY [INTEGER] (not an ARRAY [INTEGER_8] as per the new types for manifest arrays) so that existing code still works. However, when I write: ~~~~ local a: ARRAY [INTEGER] do a := <<>> ~~~~ the compiler does not create an ARRAY [INTEGER] but an ARRAY [NONE]. This is plain wrong because ARRAY [NONE] does not conform to ARRAY [INTEGER]. When I write: ~~~~ local a: ARRAY [INTEGER] n: ARRAY [NONE] do create n.make_empty a := n ~~~~ I get a compilation error as expected. So ARRAY [NONE} definitely does not conform to ARRAY [INTEGER]. But here: ~~~~ local a: ARRAY [INTEGER] do a := <<>> if not attached {ARRAY [INTEGER]} a then print ("Dynamic type does not conform to static type") end ~~~~ the message gets printed! The solutions are either to let the compiler create an empty ARRAY [INTEGER] instead of an ARRAY [NONE] (preferred solution), or emit a compilation error. -- Eric Bezault
To Reproduce
Problem Report Interactions