diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_TypeChecker_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_TypeChecker_test.res index efd9bb18..a3ee2712 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_TypeChecker_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_TypeChecker_test.res @@ -68,3 +68,5 @@ myTypeCheckTest(test, "number | string", "1", "Ok") myTypeCheckTest(test, "date | string", "1", "Expected type: (date | string) but got: 1") myTypeCheckTest(test, "number<-min(10)", "10", "Ok") myTypeCheckTest(test, "number<-min(10)", "0", "Expected type: number<-min(10) but got: 0") +myTypeCheckTest(test, "any", "0", "Ok") +myTypeCheckTest(test, "any", "'a'", "Ok") diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_TypeChecker.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_TypeChecker.res index fa118079..33cbbeca 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_TypeChecker.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_TypeChecker.res @@ -7,10 +7,15 @@ open InternalExpressionValue let rec isITypeOf = (anIType: T.iType, aValue): result => { let caseTypeIdentifier = (anUpperTypeName, aValue) => { let aTypeName = anUpperTypeName->Js.String2.toLowerCase - let valueTypeName = aValue->valueToValueType->valueTypeToString->Js.String2.toLowerCase - switch aTypeName == valueTypeName { - | true => Ok(true) - | false => T.TypeMismatch(anIType, aValue)->Error + switch aTypeName { + | "any" => Ok(true) + | _ => { + let valueTypeName = aValue->valueToValueType->valueTypeToString->Js.String2.toLowerCase + switch aTypeName == valueTypeName { + | true => Ok(true) + | false => T.TypeMismatch(anIType, aValue)->Error + } + } } }