Import modules' extension methods only with unqualified import statements (#3906)

# Important Notes
Note that one cannot
```
import Standard.Table as Table_Module
```
because of the 2-component name restriction that gets desugared to `Standard.Table.Main` and we have to write
```
import Standard.Table.Main as Table_Module
```
in a few places. Once we move `Json.to_table` extension this can be improved.
This commit is contained in:
Hubert Plociniczak 2022-12-01 11:13:34 +01:00 committed by GitHub
parent 030dbe4973
commit 06bd69436b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
128 changed files with 301 additions and 17 deletions

View File

@ -456,6 +456,7 @@
- [Add the `Self` keyword referring to current type][3844]
- [Support VCS for projects in Language Server][3851]
- [Support multiple exports of the same module][3897]
- [Import modules' extension methods only with unqualified imports][3906]
- [Don't export polyglot symbols][3915]
- [From/all import must not include module in name resolution][3931]
@ -526,6 +527,7 @@
[3844]: https://github.com/enso-org/enso/pull/3844
[3851]: https://github.com/enso-org/enso/pull/3851
[3897]: https://github.com/enso-org/enso/pull/3897
[3906]: https://github.com/enso-org/enso/pull/3906
[3915]: https://github.com/enso-org/enso/pull/3915
[3931]: https://github.com/enso-org/enso/pull/3931

View File

@ -15,8 +15,8 @@ import project.Random
from project.Data.Boolean import Boolean, True, False
from project.Data.Index_Sub_Range import Index_Sub_Range, take_helper, drop_helper
from project.Data.Json import Json
from project.Data.Range import Range
from project.Data.Json import all
from project.Data.Range import all
from project.Error.Common import Error, Panic, Index_Out_Of_Bounds_Error, Index_Out_Of_Bounds_Error_Data, No_Such_Method_Error, No_Such_Method_Error_Data, Illegal_Argument_Error_Data, Incomparable_Values_Error, Type_Error_Data, Unsupported_Argument_Types_Data
polyglot java import java.lang.IndexOutOfBoundsException

View File

@ -40,6 +40,7 @@ export project.Excel.Excel_Range.Excel_Range
export project.Data.Data_Formatter.Data_Formatter
from Standard.Geo.Geo_Json import Object_Type
import Standard.Geo.Geo_Json
## ALIAS To Table

View File

@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.logging.Level;
import org.enso.compiler.ModuleCache;
import org.enso.compiler.context.SimpleUpdate;
import org.enso.compiler.core.IR;
@ -434,6 +435,20 @@ public final class Module implements TruffleObject {
return scope;
}
/**
* Returns the runtime scope of this module that filters out only the requested types. If the list
* of requested types is empty, returns the unchanged runtime scope.
*
* @param types a list of types to include in the scope
*/
public ModuleScope getScope(List<String> types) {
if (types.isEmpty()) {
return scope;
} else {
return scope.withTypes(types);
}
}
/** @return the qualified name of this module. */
public QualifiedName getName() {
return name;

View File

@ -1,9 +1,7 @@
package org.enso.interpreter.runtime.scope;
import com.oracle.truffle.api.CompilerDirectives;
import java.util.*;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.interop.TruffleObject;
import org.enso.interpreter.runtime.EnsoContext;
import org.enso.interpreter.runtime.Module;
@ -12,16 +10,25 @@ import org.enso.interpreter.runtime.data.Type;
import org.enso.interpreter.runtime.error.RedefinedMethodException;
import org.enso.interpreter.runtime.error.RedefinedConversionException;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
/** A representation of Enso's per-file top-level scope. */
public final class ModuleScope implements TruffleObject {
private final Type associatedType;
private final Module module;
private Map<String, Object> polyglotSymbols = new HashMap<>();
private Map<String, Type> types = new HashMap<>();
private Map<Type, Map<String, Function>> methods = new HashMap<>();
private Map<Type, Map<Type, Function>> conversions = new HashMap<>();
private Set<ModuleScope> imports = new HashSet<>();
private Set<ModuleScope> exports = new HashSet<>();
private Map<String, Object> polyglotSymbols;
private Map<String, Type> types;
private Map<Type, Map<String, Function>> methods;
private Map<Type, Map<Type, Function>> conversions;
private Set<ModuleScope> imports;
private Set<ModuleScope> exports;
/**
* Creates a new object of this class.
@ -30,6 +37,12 @@ public final class ModuleScope implements TruffleObject {
* @param context the current langauge context
*/
public ModuleScope(Module module, EnsoContext context) {
this.polyglotSymbols = new HashMap<>();
this.types = new HashMap<>();
this.methods = new HashMap<>();
this.conversions = new HashMap<>();
this.imports = new HashSet<>();
this.exports = new HashSet<>();
this.module = module;
this.associatedType =
Type.createSingleton(
@ -39,6 +52,25 @@ public final class ModuleScope implements TruffleObject {
false);
}
public ModuleScope(
Module module,
Type associatedType,
Map<String, Object> polyglotSymbols,
Map<String, Type> types,
Map<Type, Map<String, Function>> methods,
Map<Type, Map<Type, Function>> conversions,
Set<ModuleScope> imports,
Set<ModuleScope> exports) {
this.module = module;
this.associatedType = associatedType;
this.polyglotSymbols = polyglotSymbols;
this.types = types;
this.methods = methods;
this.conversions = conversions;
this.imports = imports;
this.exports = exports;
}
public void registerType(Type type) {
types.put(type.getName(), type);
}
@ -150,7 +182,7 @@ public final class ModuleScope implements TruffleObject {
* @param name the method name.
* @return the matching method definition or null if not found.
*/
@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public Function lookupMethodDefinition(Type type, String name) {
Function definedWithAtom = type.getDefinitionScope().getMethodMapFor(type).get(name);
if (definedWithAtom != null) {
@ -169,7 +201,7 @@ public final class ModuleScope implements TruffleObject {
.orElse(null);
}
@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public Function lookupConversionDefinition(Type type, Type target) {
Function definedWithAtom = type.getDefinitionScope().getConversionsFor(target).get(type);
if (definedWithAtom != null) {
@ -262,4 +294,50 @@ public final class ModuleScope implements TruffleObject {
conversions = new HashMap<>();
polyglotSymbols = new HashMap<>();
}
/**
* Create a copy of this `ModuleScope` while taking into account only the provided list of types.
*
* @param typeNames list of types to copy to the new scope
* @return a copy of this scope modulo the requested types
*/
public ModuleScope withTypes(List<String> typeNames) {
Map<String, Object> polyglotSymbols = new HashMap<>(this.polyglotSymbols);
Map<String, Type> requestedTypes = new HashMap<>(this.types);
Map<Type, Map<String, Function>> methods = new HashMap<>();
Map<Type, Map<Type, Function>> conversions = new HashMap<>();
Set<ModuleScope> imports = new HashSet<>(this.imports);
Set<ModuleScope> exports = new HashSet<>(this.exports);
this.types
.entrySet()
.forEach(
entry -> {
if (typeNames.contains(entry.getKey())) {
requestedTypes.put(entry.getKey(), entry.getValue());
}
});
Collection<Type> validTypes = requestedTypes.values();
this.methods.forEach(
(tpe, meths) -> {
if (validTypes.contains(tpe)) {
methods.put(tpe, meths);
}
});
this.conversions.forEach(
(tpe, meths) -> {
if (validTypes.contains(tpe)) {
conversions.put(tpe, meths);
}
});
return new ModuleScope(
module,
associatedType,
polyglotSymbols,
requestedTypes,
methods,
conversions,
imports,
exports);
}
}

View File

@ -84,6 +84,7 @@ import scala.annotation.tailrec
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
import scala.jdk.OptionConverters._
import scala.jdk.CollectionConverters._
/** This is an implementation of a codegeneration pass that lowers the Enso
* [[IR]] into the truffle [[org.enso.compiler.core.Core.Node]] structures that
@ -178,7 +179,11 @@ class IrToTruffle(
imp.target match {
case BindingsMap.ResolvedType(_, _) =>
case ResolvedModule(module) =>
moduleScope.addImport(module.unsafeAsModule().getScope)
val mod = module.unsafeAsModule()
val scope: ModuleScope = imp.importDef.onlyNames
.map(only => mod.getScope(only.map(_.name).asJava))
.getOrElse(mod.getScope())
moduleScope.addImport(scope)
}
}

View File

@ -0,0 +1,6 @@
name: Test_Extension_Methods_Success
license: APLv2
enso-version: default
version: "0.0.1"
author: "Enso Team <contact@enso.org>"
maintainer: "Enso Team <contact@enso.org>"

View File

@ -0,0 +1,7 @@
from Standard.Base.Data.Numbers import Integer
type Foo
A
B
Integer.foo self a = 1 + a

View File

@ -0,0 +1,5 @@
import project.Atom.Foo
from project.Atom.Foo import A
main =
1.foo 41

View File

@ -0,0 +1,6 @@
name: Test_Extension_Methods_Success_1
license: APLv2
enso-version: default
version: "0.0.1"
author: "Enso Team <contact@enso.org>"
maintainer: "Enso Team <contact@enso.org>"

View File

@ -0,0 +1,7 @@
from Standard.Base.Data.Numbers import Integer
type Foo
A
B
Integer.foo self a = 1 + a

View File

@ -0,0 +1,4 @@
import project.Atom
main =
1.foo 41

View File

@ -0,0 +1,6 @@
name: Test_Extension_Methods_Success_2
license: APLv2
enso-version: default
version: "0.0.1"
author: "Enso Team <contact@enso.org>"
maintainer: "Enso Team <contact@enso.org>"

View File

@ -0,0 +1,7 @@
from Standard.Base.Data.Numbers import Integer
type Foo
A
B
Integer.foo self a = 1 + a

View File

@ -0,0 +1,4 @@
from project.Atom import all
main =
1.foo 41

View File

@ -90,6 +90,20 @@ class ImportsTest extends PackageTest {
outLines(3) shouldEqual "(Mk_C 10)"
}
"Importing module" should "bring extension methods into the scope " in {
evalTestProject("Test_Extension_Methods_Success_1") shouldEqual 42
}
"The unqualified import of a module" should "bring extension methods into the scope " in {
evalTestProject("Test_Extension_Methods_Success_2") shouldEqual 42
}
"Importing module's types" should "not bring extension methods into the scope " in {
the[InterpreterException] thrownBy evalTestProject(
"Test_Extension_Methods_Failure"
) should have message "Method `foo` of 1 (Integer) could not be found."
}
"Compiler" should "detect name conflicts preventing users from importing submodules" in {
the[InterpreterException] thrownBy evalTestProject(
"TestSubmodulesNameConflict"

View File

@ -3,6 +3,7 @@ from Standard.Base import all
import Standard.Examples
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
# While we're lacking the ability to run the documentation examples
# automatically (#1706), these tests at least check that each of the examples

View File

@ -4,6 +4,7 @@ from Standard.Table.Data.Table.Table import Table_Data
import Standard.Geo
from Standard.Test import Test
import Standard.Test.Extensions
spec =
Test.group "Geo Points" <|

View File

@ -4,6 +4,7 @@ from Standard.Image import Image, Matrix
import Standard.Image.Data.Matrix_Error.Matrix_Error
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "Image with 1 channel" <|

View File

@ -4,6 +4,7 @@ from Standard.Image import Matrix
import Standard.Image.Data.Matrix_Error.Matrix_Error
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "Matrix_Error" <|

View File

@ -3,6 +3,7 @@ from Standard.Base import all
from Standard.Image import Image, Read_Flag, Write_Flag
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
polyglot java import java.lang.System as Java_System

View File

@ -7,6 +7,7 @@ import Standard.Table.Internal.Aggregate_Column_Helper
import Standard.Table.Internal.Problem_Builder.Problem_Builder
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Aggregate Columns" <|
simple_table = Table.new [["count", [1, 2, Nothing, 3, Nothing]], ["is_valid", [Nothing, False, True, False, Nothing]], ["float", [3.4, 1, 5.6, 2.1, Nothing]], ["text", ["A", "", Nothing, "B,C", Nothing]]]

View File

@ -7,6 +7,7 @@ from Standard.Table.Errors import Missing_Input_Columns_Data, Column_Indexes_Out
from Standard.Database.Errors import Unsupported_Database_Operation_Error_Data
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
polyglot java import java.lang.Double

View File

@ -5,6 +5,7 @@ import Standard.Table.Data.Storage.Storage
import Standard.Examples
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
polyglot java import org.enso.table.data.column.storage.Storage as Java_Storage

View File

@ -12,6 +12,7 @@ from Standard.Table.Errors import all
from Standard.Database.Errors import SQL_Error_Data, Unsupported_Database_Operation_Error_Data
from Standard.Test import Test, Problems
import Standard.Test.Extensions
from project.Util import all

View File

@ -1,8 +1,10 @@
from Standard.Base import all
from Standard.Table import Table, Column, Delimited, Column_Selector
import Standard.Table.Main as Table_Module
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
from project.Util import all

View File

@ -4,6 +4,7 @@ from Standard.Table import Table, Column, Data_Formatter, Quote_Style
from Standard.Table.Errors import all
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
type Custom_Type
Value field

View File

@ -11,6 +11,7 @@ from Standard.Database.Data.Table import combine_names, fresh_names
from Standard.Database.Errors import Unsupported_Database_Operation_Error_Data
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
import project.Database.Helpers.Fake_Test_Connection

View File

@ -8,6 +8,7 @@ from Standard.Database import all
from Standard.Database.Errors import Unsupported_Database_Operation_Error_Data
from Standard.Test import Test, Problems
import Standard.Test.Extensions
import project.Database.Helpers.Name_Generator

View File

@ -11,6 +11,7 @@ import Standard.Database.Data.SQL_Type.SQL_Type
import Standard.Database.Internal.Postgres.Pgpass
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
import Standard.Test.Test_Environment
import project.Database.Common_Spec

View File

@ -6,6 +6,7 @@ from Standard.Table import Table
from Standard.Database import Database, Redshift, AWS_Credential, SQL_Query
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
import project.Database.Common_Spec
import project.Database.Helpers.Name_Generator

View File

@ -7,6 +7,7 @@ from Standard.Database import Database, SQLite, In_Memory, SQL_Query
from Standard.Database.Errors import SQL_Error_Data
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
import project.Database.Common_Spec
import project.Database.Helpers.Name_Generator

View File

@ -1,9 +1,12 @@
from Standard.Base import all
from Standard.Table import Table, Column, Data_Formatter, Quote_Style, Delimited
import Standard.Table.Data.Table_Conversions
import Standard.Table.Main as Table_Module
from Standard.Table.Errors import all
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
import project.Util

View File

@ -4,6 +4,7 @@ from Standard.Table import Table, Column, Data_Formatter, Quote_Style, Column_Na
from Standard.Table.Errors import all
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
from project.Util import all

View File

@ -5,6 +5,7 @@ from Standard.Table import Table, Match_Columns, Column_Name_Mapping, Excel, Exc
from Standard.Table.Errors import Invalid_Output_Column_Names_Data, Duplicate_Output_Column_Names_Data, Invalid_Location_Data, Range_Exceeded_Data, Existing_Data_Data, Column_Count_Mismatch_Data, Column_Name_Mismatch_Data
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
import Standard.Examples

View File

@ -6,6 +6,7 @@ import Standard.Table.Data.Expression.Expression_Error
import Standard.Visualization
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
import project.Common_Table_Spec
from project.Util import all

View File

@ -1,7 +1,9 @@
from Standard.Base import all
from Standard.Table import Table
import Standard.Table.Main as Table_Module
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
import project.Util

View File

@ -8,6 +8,7 @@ from Standard.Table.Errors import Invalid_Format, Leading_Zeros, Missing_Input_C
import Standard.Visualization
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
spec = Test.group "Table.parse_values" <|
Test.specify "should correctly parse integers" <|

View File

@ -1,9 +1,11 @@
from Standard.Base import all
from Standard.Table import Table, Column, Delimited, Data_Formatter
import Standard.Table.Data.Table_Conversions
import Standard.Table.Data.Storage.Storage
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
from project.Util import all
spec =

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Table import Table, Column, Sort_Column, Column_Selector, Sort_Column_Selector, Aggregate_Column
import Standard.Table.Main as Table_Module
from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all hiding First, Last
from Standard.Table.Data.Table import Empty_Error
from Standard.Table.Data.Storage import Storage
@ -10,6 +11,7 @@ from Standard.Table.Errors import Invalid_Output_Column_Names_Data, Duplicate_Ou
import Standard.Visualization
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
import project.Common_Table_Spec
from project.Util import all

View File

@ -4,6 +4,7 @@ from Standard.Table import Table, Delimited, Column, Data_Formatter
import Standard.Table.Data.Storage
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
from project.Util import all

View File

@ -4,6 +4,7 @@ from Standard.Table import Table, Delimited, Column, Data_Formatter
import Standard.Table.Data.Storage
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
from project.Util import all

View File

@ -3,6 +3,7 @@ from Standard.Base import all
import Standard.Table.Internal.Unique_Name_Strategy.Unique_Name_Strategy
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group 'Unique_Name_Strategy Helper' <|
Test.specify 'should change an empty name to "Column"' <|

View File

@ -3,6 +3,7 @@ from Standard.Base import all
from Standard.Table import Table, Column
from Standard.Test import Test
import Standard.Test.Extensions
Table.should_equal self expected =
self_cols = self.columns

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "JavaScript Objects, Arrays & Functions" <|

View File

@ -2,6 +2,7 @@ from Standard.Base import all
from Standard.Base.Data.Array_Proxy import Array_Proxy
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
type Proxy_Object
Value length

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
polyglot java import java.util.LinkedHashSet

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
Boolean.method self = self

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "identity" <|

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "Bound" <|

View File

@ -2,6 +2,7 @@ from Standard.Base import all
from Standard.Base.Data.Json import Json_Parse_Error, No_Such_Field
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
import Standard.Test.Test_Result.Test_Result
type Author

View File

@ -3,6 +3,7 @@ import Standard.Base.Runtime.State
from Standard.Base.Data.List import Empty_Error
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "List" <|
l = List.Cons 1 <| List.Cons 2 <| List.Cons 3 <| List.Nil

View File

@ -3,6 +3,7 @@ from Standard.Base import all
polyglot java import java.util.Locale as JavaLocale
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
with_locale locale ~test =
default_locale = JavaLocale.getDefault

View File

@ -3,6 +3,7 @@ from Standard.Base import all
from Standard.Base.Data.Map import No_Value_For_Key
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Maps" <|
m = Map.empty . insert 1 2 . insert 2 4

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Maybe" <|
Test.specify "should have a None variant" <|

View File

@ -5,6 +5,7 @@ import Standard.Base.Data.Noise.Deterministic_Random
import Standard.Base.Error.Common
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "Generator Interface" <|

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
type My_Generator
My_Generator.step self _ _ = 1

View File

@ -3,6 +3,7 @@ from Standard.Base import all
from Standard.Base.Data.Numbers import Number_Parse_Error
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
Integer.is_even self = self % 2 == 0

View File

@ -5,6 +5,7 @@ import Standard.Base.Data.Ordering.Comparator
polyglot java import java.lang.ClassCastException
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
# === Test Resources ===

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Natural Order" <|
case_insensitive_compare a b = Natural_Order.compare a b Case_Sensitivity.Insensitive

View File

@ -3,6 +3,7 @@ from Standard.Base import all
import Standard.Base.Data.Ordering.Vector_Lexicographic_Order
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
type My_Type
Value a b

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
# === Test Resources ===

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
polyglot java import java.time.LocalDate
polyglot java import java.lang.String

View File

@ -3,6 +3,7 @@ from Standard.Base import all
import Standard.Base.Runtime.Ref.Ref
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Range" <|
Test.specify "should be created with a start, an end and a step" <|

View File

@ -3,6 +3,7 @@ from Standard.Base import all
import Standard.Base.Runtime.Ref.Ref
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Refs" <|
Test.specify "should be able to store and retrieve value in references" <|

View File

@ -1,6 +1,7 @@
from Standard.Base import Nothing, Vector, Number, Decimal, True, Illegal_Argument_Error_Data, False, Regression
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
## Regression test data produced using an Excel spreadsheet.

View File

@ -2,6 +2,7 @@ from Standard.Base import all
from Standard.Base.Data.Vector import Empty_Error
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
# === Test Resources ===

View File

@ -7,6 +7,7 @@ import Standard.Base.Data.Text.Regex.Option as Global_Option
polyglot java import java.util.regex.Pattern as Java_Pattern
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
default_mask = Java_Pattern.CANON_EQ.bit_or Java_Pattern.UNICODE_CASE . bit_or Java_Pattern.UNICODE_CHARACTER_CLASS

View File

@ -3,6 +3,7 @@ from Standard.Base import all
from Standard.Base.Data.Text.Encoding import all_character_sets, all_encodings, Encoding
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
spec =
Test.group "Encoding object" <|

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite, Problems
import Standard.Test.Extensions
type Foo_Error

View File

@ -4,6 +4,7 @@ import Standard.Base.Data.Text.Regex.Option
import Standard.Base.Data.Text.Regex.Engine.Default as Default_Engine
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "Regex options handling" <|

View File

@ -2,6 +2,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Text.Span" <|

View File

@ -3,6 +3,7 @@ from Standard.Base import all
from Standard.Base.Data.Text.Text_Sub_Range import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Text_Sub_Range_Data" <|
Test.specify "should correctly split a text into grapheme cluster ranges expressed in codepoint indices" <|

View File

@ -5,6 +5,7 @@ polyglot java import org.enso.base.text.CaseFoldedString
polyglot java import com.ibm.icu.text.BreakIterator
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "Text_Utils" <|

View File

@ -7,6 +7,7 @@ from Standard.Base.Data.Text.Text_Sub_Range.Text_Sub_Range import all
from Standard.Base.Data.Index_Sub_Range.Index_Sub_Range import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
type Auto
Value a

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test
import Standard.Test.Extensions
spec name create_new_date =
Test.group (name + "date part tests") <|

View File

@ -3,6 +3,7 @@ from Standard.Base import all
from Standard.Base.Error.Common import Time_Error
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
import project.Data.Time.Date_Part_Spec

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
import project.Data.Time.Date_Part_Spec

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "Day_Of_Week conversions" <|

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
polyglot java import java.time.Duration as Java_Duration
polyglot java import java.time.LocalDate

View File

@ -1,5 +1,6 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec =
Test.group "Period" <|

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test_Suite
import Standard.Test.Extensions
import project.Data.Time.Duration_Spec
import project.Data.Time.Period_Spec

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
polyglot java import java.time.LocalTime
polyglot java import java.time.format.DateTimeFormatter

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
polyglot java import java.time.ZoneId
polyglot java import java.time.ZoneOffset

View File

@ -2,6 +2,7 @@ from Standard.Base import all
import Standard.Base.Data.Index_Sub_Range
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Vector Slicing Helpers" <|
Test.specify "should be able to sort correctly merge neighboring sequences" <|

View File

@ -4,6 +4,7 @@ from Standard.Base.Data.Vector import Empty_Error
import Standard.Base.Runtime.Ref.Ref
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
type T
Value a b

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test_Suite
import Standard.Test.Extensions
import project.Semantic.Any_Spec
import project.Semantic.Case_Spec

View File

@ -3,6 +3,7 @@ from Standard.Base import all
import Standard.Base.Network.Http.Header
from Standard.Test import Test
import Standard.Test.Extensions
spec =
Test.group "Header" <|

View File

@ -8,6 +8,7 @@ import Standard.Base.Network.Http.Request.Body as Request_Body
import Standard.Base.Network.URI
from Standard.Test import Test
import Standard.Test.Extensions
spec =
test_uri = URI.parse "https://httpbin.org/post"

View File

@ -12,6 +12,7 @@ import Standard.Base.Network.Proxy
import Standard.Base.Network.URI
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
polyglot java import java.lang.System

View File

@ -3,6 +3,7 @@ from Standard.Base import all
import Standard.Base.Network.URI
from Standard.Test import Test
import Standard.Test.Extensions
spec =
Test.group "URI" <|

View File

@ -3,6 +3,7 @@ from Standard.Base import all
import Standard.Base.Random
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Random" <|
Test.specify "should allow to generate random indices" <|

View File

@ -1,4 +1,5 @@
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
type Generator
Value h t

View File

@ -2,6 +2,7 @@ from Standard.Base import all
import Standard.Base.Runtime.Managed_Resource.Managed_Resource
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Managed_Resource" <|
Test.specify "should call the destructor even if the action fails" <|

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test
import Standard.Test.Extensions
type My_Type

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test
import Standard.Test.Extensions
type My_Type
Value a

View File

@ -12,6 +12,7 @@ polyglot java import java.util.List as JList
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
spec = Test.group "Pattern Matches" <|
Test.specify "should be able to match on the Boolean type" <|

View File

@ -4,6 +4,7 @@ import project.Semantic.Conversion.Methods
import project.Semantic.Conversion.Types
from Standard.Test import Test
import Standard.Test.Extensions
type Foo
Value foo

View File

@ -3,6 +3,7 @@ from Standard.Base import all
import project.Semantic.Deep_Export.Internal
from Standard.Test import Test
import Standard.Test.Extensions
spec =
Test.group "Deep Exports" <|

View File

@ -1,6 +1,7 @@
from Standard.Base import all
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
from project.Semantic.Default_Args_Spec.Box import all

Some files were not shown because too many files have changed in this diff Show More