diff --git a/src/nodes/Evaluate.test.ts b/src/nodes/Evaluate.test.ts index 449ad8147..9d2a46d5a 100644 --- a/src/nodes/Evaluate.test.ts +++ b/src/nodes/Evaluate.test.ts @@ -13,6 +13,7 @@ import UnexpectedTypeInput from '@conflicts/UnexpectedTypeInput'; import type Node from './Node'; import type Conflict from '../conflicts/Conflict'; import evaluateCode from '../runtime/evaluate'; +import UnionType from './UnionType'; test.each([ [ @@ -143,7 +144,7 @@ test('Test generics', () => { // Infer the type from an input. testTypes('ƒ test⸨T⸩(a•T) a\ntest(1)', NumberType); // Infer from lists - testTypes('[ 1 2 3 ].random()', NumberType); + testTypes('[ 1 2 3 ].random()', UnionType); // Infer from sets testTypes('{ 1 2 3 }.remove(1)', SetType); // Infer from map higher order function diff --git a/src/nodes/ListLiteral.ts b/src/nodes/ListLiteral.ts index 0d6e866ab..e6bd69f0b 100644 --- a/src/nodes/ListLiteral.ts +++ b/src/nodes/ListLiteral.ts @@ -103,10 +103,7 @@ export default class ListLiteral extends Expression { computeType(context: Context): Type { // Strip away any concrete types in the item types. - return ListType.make( - this.getItemType(context), - this.values.length - ).generalize(context); + return ListType.make(this.getItemType(context), this.values.length); } computeConflicts(): Conflict[] { diff --git a/static/examples/Maze.wp b/static/examples/Maze.wp index 68cd7b03b..d15fd7c98 100644 --- a/static/examples/Maze.wp +++ b/static/examples/Maze.wp @@ -3,7 +3,7 @@ Maze ``A maze is a 2D grid of emoji, with some functions for checking the state at particular grid postions. Mazes are generated randomly.``/en •Maze() ( - grid: + grid•[[''|ø]]: [ [ '🎬' '❤️' '❌' ø ø] [ '❤️' ø ø ø ø]