diff --git a/CHANGELOG.md b/CHANGELOG.md index 844991c00f03..2c363c9d2773 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -818,6 +818,7 @@ - [Add project creation time to project metadata][6780] - [Upgrade GraalVM to 22.3.1 JDK17][6750] - [Ascribed types are checked during runtime][6790] +- [Add compiler pass that discovers ambiguous and duplicated symbols][6868] - [Improve and colorize compiler's diagnostic messages][6931] - [Execute some runtime commands synchronously to avoid race conditions][6998] @@ -934,6 +935,7 @@ [6755]: https://github.com/enso-org/enso/pull/6755 [6780]: https://github.com/enso-org/enso/pull/6780 [6790]: https://github.com/enso-org/enso/pull/6790 +[6868]: https://github.com/enso-org/enso/pull/6868 [6931]: https://github.com/enso-org/enso/pull/6931 [6998]: https://github.com/enso-org/enso/pull/6998 diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Any.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Any.enso index d3f91886b890..c1eb8ddd7bf4 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Any.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Any.enso @@ -1,5 +1,5 @@ import project.Data.Pair.Pair -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Text.Text import project.Data.Vector.Vector import project.Error.Error diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso index 490b6d43d027..d4a02d2c3b40 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso @@ -3,9 +3,9 @@ import project.Data.Numbers.Integer import project.Data.Filter_Condition.Filter_Condition import project.Data.List.List import project.Data.Ordering.Ordering -import project.Data.Ordering.Sort_Direction.Sort_Direction +import project.Data.Sort_Direction.Sort_Direction import project.Data.Pair.Pair -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Range.Range import project.Data.Text.Text import project.Data.Vector.Vector diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Filter_Condition.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Filter_Condition.enso index f81ffa50b9af..c7b36c0708c1 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Filter_Condition.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Filter_Condition.enso @@ -1,7 +1,6 @@ import project.Any.Any -import project.Data.Boolean.Boolean import project.Data.Text.Case_Sensitivity.Case_Sensitivity -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Regex import project.Data.Text.Text import project.Data.Vector.Vector diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Index_Sub_Range.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Index_Sub_Range.enso index 0f0c4ef4a78b..6e203996b609 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Index_Sub_Range.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Index_Sub_Range.enso @@ -1,7 +1,7 @@ import project.Any.Any import project.Data.Numbers.Integer import project.Data.Range.Range -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Text.Text import project.Data.Vector.Vector import project.Errors.Common.Index_Out_Of_Bounds diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso index 6e618f35fed5..849d38a5af83 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso @@ -1,13 +1,13 @@ import project.Any.Any import project.Data.Array.Array import project.Data.Array_Proxy.Array_Proxy -import project.Data.Json.Extensions +from project.Data.Json.Extensions import all import project.Data.Map.Map import project.Data.Numbers.Integer import project.Data.Numbers.Number import project.Data.Pair.Pair -import project.Data.Range.Extensions -import project.Data.Text.Extensions +from project.Data.Range.Extensions import all +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Data.Vector.Vector import project.Errors.Common.Type_Error diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json/Extensions.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json/Extensions.enso index f175cb8e94c4..92ab73fef62d 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json/Extensions.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json/Extensions.enso @@ -8,8 +8,8 @@ import project.Data.Map.Map import project.Data.Numbers.Decimal import project.Data.Numbers.Integer import project.Data.Numbers.Number -import project.Data.Range.Extensions -import project.Data.Text.Extensions +from project.Data.Range.Extensions import all +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Data.Text.Text_Sub_Range.Text_Sub_Range import project.Data.Vector.Vector diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Locale.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Locale.enso index a16b9317bb27..ec5d96dd3a33 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Locale.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Locale.enso @@ -1,7 +1,7 @@ import project.Any.Any import project.Data.Filter_Condition.Filter_Condition import project.Data.Text.Case.Case -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Data.Vector.Vector import project.Metadata.Display diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Map.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Map.enso index 08338b088d44..f7359651211c 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Map.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Map.enso @@ -2,7 +2,7 @@ import project.Any.Any import project.Data.Numbers.Integer import project.Data.Vector.Vector import project.Data.Pair.Pair -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Error.Error import project.Errors.Illegal_Argument.Illegal_Argument diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Pair.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Pair.enso index bb0bc630d22d..23ac4bb4daf3 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Pair.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Pair.enso @@ -2,7 +2,7 @@ import project.Any.Any import project.Data.Boolean.Boolean import project.Data.Numbers.Integer import project.Data.Text.Text -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Vector.Vector import project.Errors.Common.Index_Out_Of_Bounds import project.Errors.Common.Not_Found diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Set.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Set.enso index f3b291970a53..8393b361d43e 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Set.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Set.enso @@ -5,7 +5,7 @@ import project.Data.Numbers.Integer import project.Data.Ordering.Comparable import project.Data.Ordering.Ordering import project.Data.Vector.Vector -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Errors.Illegal_Argument.Illegal_Argument import project.Nothing.Nothing diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Ordering/Sort_Direction.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Sort_Direction.enso similarity index 100% rename from distribution/lib/Standard/Base/0.0.0-dev/src/Data/Ordering/Sort_Direction.enso rename to distribution/lib/Standard/Base/0.0.0-dev/src/Data/Sort_Direction.enso diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Statistics.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Statistics.enso index 58f1fc1fbd83..f9f721db116a 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Statistics.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Statistics.enso @@ -5,7 +5,7 @@ import project.Data.Numbers.Integer import project.Data.Numbers.Number import project.Data.Ordering.Ordering import project.Data.Ordering.Comparable -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Vector.Vector import project.Errors.Common.Incomparable_Values import project.Error.Error diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Extensions.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Extensions.enso index 9c9ee6420455..af6f77b21b69 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Extensions.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Extensions.enso @@ -4,7 +4,7 @@ import project.Any.Any import project.Data.Array.Array import project.Data.Index_Sub_Range.Index_Sub_Range import project.Data.Locale.Locale -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Range.Range import project.Data.Text.Case.Case import project.Data.Text.Case_Sensitivity.Case_Sensitivity @@ -38,7 +38,6 @@ import project.Nothing.Nothing from project.Data.Boolean import Boolean, True, False from project.Data.Json import Json, Invalid_JSON, JS_Object from project.Data.Numbers import Decimal, Integer, Number, Number_Parse_Error -from project.Data.Text.Text_Sub_Range import Codepoint_Ranges, Text_Sub_Range from project.Widget_Helpers import make_delimiter_selector diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Match.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Match.enso index a58622fbda81..b09d257ead85 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Match.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Match.enso @@ -1,7 +1,7 @@ import project.Any.Any import project.Data.Map.Map import project.Data.Numbers.Integer -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Range.Range import project.Data.Text.Regex.No_Such_Group import project.Data.Text.Regex.Pattern.Pattern diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Pattern.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Pattern.enso index cb688590a7f3..f50f0884e7ce 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Pattern.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Pattern.enso @@ -2,9 +2,9 @@ import project.Any.Any import project.Data.Filter_Condition.Filter_Condition import project.Data.Map.Map import project.Data.Numbers.Integer -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Range.Range -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Helpers import project.Data.Text.Span.Span import project.Data.Text.Span.Utf_16_Span diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Replacer.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Replacer.enso index 52ec26d15f59..1f062fa06fd2 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Replacer.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Replacer.enso @@ -1,5 +1,5 @@ import project.Data.Numbers.Integer -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Regex import project.Data.Text.Regex.Match.Match import project.Data.Text.Regex.No_Such_Group diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Span.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Span.enso index 99b0059a0da3..aff480e033fa 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Span.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Span.enso @@ -11,7 +11,7 @@ import project.Data.Numbers.Integer import project.Data.Pair.Pair -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Range.Range import project.Data.Text.Text import project.Errors.Common.Index_Out_Of_Bounds diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Text_Sub_Range.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Text_Sub_Range.enso index 3b326c5a107f..cf1f623535a8 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Text_Sub_Range.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Text_Sub_Range.enso @@ -1,7 +1,7 @@ import project.Data.Index_Sub_Range.Index_Sub_Range import project.Data.Numbers.Integer import project.Data.Pair.Pair -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Range.Range import project.Data.Text.Text import project.Data.Vector.Vector diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Range.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Range.enso index c548855796d7..ec8ccf2d330b 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Range.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Range.enso @@ -3,7 +3,7 @@ import project.Data.Filter_Condition.Filter_Condition import project.Data.Json.JS_Object import project.Data.Numbers.Integer import project.Data.Range.Empty_Error -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Text.Text import project.Data.Time.Date.Date import project.Data.Time.Date_Period.Date_Period diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Duration.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Duration.enso index 062e81cc3842..a36a75939a47 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Duration.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Duration.enso @@ -4,7 +4,7 @@ import project.Data.Numbers.Decimal import project.Data.Numbers.Integer import project.Data.Ordering.Comparable import project.Data.Pair.Pair -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Data.Time.Date_Time.Date_Time import project.Data.Time.Period.Period diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Period.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Period.enso index 2d4c3dd8fc27..2dbff8cb3772 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Period.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Period.enso @@ -2,7 +2,7 @@ import project.Any.Any import project.Data.Json.JS_Object import project.Data.Numbers.Integer import project.Data.Ordering.Comparable -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Data.Time.Date.Date import project.Data.Time.Duration.Duration diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso index 4324bbc81da7..294406fcb81f 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso @@ -4,11 +4,11 @@ import project.Data.Filter_Condition.Filter_Condition import project.Data.List.List import project.Data.Map.Map import project.Data.Numbers.Integer -import project.Data.Ordering.Sort_Direction.Sort_Direction import project.Data.Pair.Pair import project.Data.Range.Range -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Text.Text +import project.Data.Sort_Direction.Sort_Direction import project.Errors.Common.Incomparable_Values import project.Errors.Common.Index_Out_Of_Bounds import project.Errors.Common.No_Such_Method diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Errors/Problem_Behavior.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Errors/Problem_Behavior.enso index 62722f44b861..663e5277150a 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Errors/Problem_Behavior.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Errors/Problem_Behavior.enso @@ -2,7 +2,6 @@ import project.Any.Any import project.Data.Vector.Vector import project.Error.Error import project.Warning.Warning -from project import all from project.Errors.Problem_Behavior.Problem_Behavior import all diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Main.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Main.enso index 5633b1bf3190..f36f01c10cd9 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Main.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Main.enso @@ -74,7 +74,7 @@ import project.Data.Filter_Condition.Filter_Condition import project.Data.Index_Sub_Range.Index_Sub_Range import project.Data.Interval.Bound import project.Data.Interval.Interval -import project.Data.Json.Extensions +from project.Data.Json.Extensions import all import project.Data.Json.Json import project.Data.Json.JS_Object import project.Data.Locale.Locale @@ -84,16 +84,16 @@ import project.Data.Ordering.Natural_Order import project.Data.Ordering.Ordering import project.Data.Ordering.Comparable import project.Data.Ordering.Default_Comparator -import project.Data.Ordering.Sort_Direction.Sort_Direction +import project.Data.Sort_Direction.Sort_Direction import project.Data.Pair.Pair import project.Data.Range.Range -import project.Data.Range.Extensions +from project.Data.Range.Extensions import all import project.Data.Regression import project.Data.Statistics import project.Data.Text.Case.Case import project.Data.Text.Case_Sensitivity.Case_Sensitivity import project.Data.Text.Encoding.Encoding -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Line_Ending_Style.Line_Ending_Style import project.Data.Text.Location.Location import project.Data.Text.Matching_Mode.Matching_Mode @@ -112,7 +112,7 @@ import project.Data.Time.Time_Of_Day.Time_Of_Day import project.Data.Time.Time_Period.Time_Period import project.Data.Time.Time_Zone.Time_Zone import project.Errors.Problem_Behavior.Problem_Behavior -import project.Network.Extensions +from project.Network.Extensions import all import project.Network.HTTP.Header.Header import project.Network.HTTP.HTTP import project.Network.HTTP.HTTP_Method.HTTP_Method @@ -126,7 +126,7 @@ export project.Data.Filter_Condition.Filter_Condition export project.Data.Index_Sub_Range.Index_Sub_Range export project.Data.Interval.Bound export project.Data.Interval.Interval -export project.Data.Json.Extensions +from project.Data.Json.Extensions export all export project.Data.Json.Json export project.Data.Json.JS_Object export project.Data.Locale.Locale @@ -135,15 +135,15 @@ export project.Data.Ordering.Natural_Order export project.Data.Ordering.Ordering export project.Data.Ordering.Comparable export project.Data.Ordering.Default_Comparator -export project.Data.Ordering.Sort_Direction.Sort_Direction export project.Data.Pair.Pair export project.Data.Range.Range -export project.Data.Range.Extensions +from project.Data.Range.Extensions export all export project.Data.Regression +export project.Data.Sort_Direction.Sort_Direction export project.Data.Text.Case.Case export project.Data.Text.Case_Sensitivity.Case_Sensitivity export project.Data.Text.Encoding.Encoding -export project.Data.Text.Extensions +from project.Data.Text.Extensions export all export project.Data.Text.Line_Ending_Style.Line_Ending_Style export project.Data.Text.Location.Location export project.Data.Text.Matching_Mode.Matching_Mode @@ -162,7 +162,7 @@ export project.Data.Time.Time_Of_Day.Time_Of_Day export project.Data.Time.Time_Period.Time_Period export project.Data.Time.Time_Zone.Time_Zone export project.Errors.Problem_Behavior.Problem_Behavior -export project.Network.Extensions +from project.Network.Extensions export all export project.Network.HTTP.Header.Header export project.Network.HTTP.HTTP export project.Network.HTTP.HTTP_Method.HTTP_Method diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP.enso index 63921feb9f4e..9c3fd4df9647 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP.enso @@ -27,8 +27,6 @@ polyglot java import java.net.http.HttpRequest polyglot java import java.net.http.HttpResponse polyglot java import java.net.InetSocketAddress polyglot java import java.net.ProxySelector -polyglot java import java.net.URI -polyglot java import java.time.Duration as Java_Duration polyglot java import org.enso.base.Http_Utils type HTTP diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Request.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Request.enso index 553132d0b4fe..76e3bd0105ca 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Request.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Request.enso @@ -2,7 +2,7 @@ import project.Any.Any import project.Data.Pair.Pair import project.Data.Text.Text import project.Data.Vector.Vector -import project.Network.Extensions +from project.Network.Extensions import all import project.Network.HTTP.Form.Form import project.Network.HTTP.Header.Header import project.Network.HTTP.HTTP_Method.HTTP_Method diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response.enso index f33dbdbfb700..fbc3f3bd428b 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response.enso @@ -3,7 +3,7 @@ import project.Data.Boolean.Boolean import project.Data.Json.JS_Object import project.Data.Numbers.Number import project.Data.Text.Encoding.Encoding -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Data.Vector.Vector import project.Error.Error diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso index 2059040fbc87..6670a7b71ac5 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso @@ -3,7 +3,7 @@ import project.Data.Json.Json import project.Data.Json.JS_Object import project.Data.Numbers.Number import project.Data.Text.Encoding.Encoding -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Data.Vector.Vector import project.Nothing.Nothing diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Random.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Random.enso index 865f389a6f11..d7321a92a41d 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Random.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Random.enso @@ -5,7 +5,6 @@ import project.Data.Numbers.Decimal import project.Data.Text.Text import project.Data.Vector.Vector import project.Data.Json.JS_Object -import project.Data.Text.Text import project.Error.Error import project.Errors.Illegal_Argument.Illegal_Argument import project.System diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Runtime.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Runtime.enso index 28af61468c6e..8c5506ed637d 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Runtime.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Runtime.enso @@ -2,7 +2,7 @@ import project.Any.Any import project.Data.Array.Array import project.Data.Boolean.Boolean import project.Data.Text.Case.Case -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Data.Vector.Vector import project.Errors.Common.Forbidden_Operation diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/System/File.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/System/File.enso index 8855ad50bc78..e4a067aa6f6c 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/System/File.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/System/File.enso @@ -1,4 +1,3 @@ -from Standard.Base import all import project.Any.Any import project.Data.Array.Array import project.Data.Index_Sub_Range.Index_Sub_Range @@ -24,6 +23,7 @@ import project.Runtime.Context import project.Runtime.Managed_Resource.Managed_Resource import project.System.File.File_Access.File_Access import project.System.File.File_Permissions.File_Permissions +import project.Warning.Warning from project.Data.Boolean import Boolean, True, False from project.System.File_Format import Auto_Detect, File_Format diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/System/File/Write_Extensions.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/System/File/Write_Extensions.enso index 14b09fbcd359..99a79f89967c 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/System/File/Write_Extensions.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/System/File/Write_Extensions.enso @@ -1,6 +1,6 @@ import project.Data.Text.Text import project.Data.Text.Encoding.Encoding -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Vector.Vector import project.Error.Error import project.Errors.Common.Unsupported_Argument_Types diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/System/File_Format.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/System/File_Format.enso index 1abaef3b9c60..e61a4827233a 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/System/File_Format.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/System/File_Format.enso @@ -1,7 +1,7 @@ import project.Any.Any import project.Data.Json.Json import project.Data.Text.Encoding.Encoding -import project.Data.Text.Extensions +from project.Data.Text.Extensions import all import project.Data.Text.Text import project.Data.Vector.Vector import project.Error.Error diff --git a/distribution/lib/Standard/Image/0.0.0-dev/src/Data/Image.enso b/distribution/lib/Standard/Image/0.0.0-dev/src/Data/Image.enso index 94824825b355..2e242e6bee79 100644 --- a/distribution/lib/Standard/Image/0.0.0-dev/src/Data/Image.enso +++ b/distribution/lib/Standard/Image/0.0.0-dev/src/Data/Image.enso @@ -3,8 +3,6 @@ import Standard.Base.Runtime.Context import Standard.Base.Errors.Common.Forbidden_Operation import Standard.Base.Errors.File_Error.File_Error -from Standard.Base.Data.Ordering import all - import project.Read_Flag.Read_Flag import project.Write_Flag.Write_Flag import project.Data.Histogram.Histogram diff --git a/distribution/lib/Standard/Image/0.0.0-dev/src/Data/Matrix.enso b/distribution/lib/Standard/Image/0.0.0-dev/src/Data/Matrix.enso index ec137273c55f..37eb61a74e72 100644 --- a/distribution/lib/Standard/Image/0.0.0-dev/src/Data/Matrix.enso +++ b/distribution/lib/Standard/Image/0.0.0-dev/src/Data/Matrix.enso @@ -1,7 +1,5 @@ from Standard.Base import all -from Standard.Base.Data.Ordering import all - import project.Data.Image.Image import project.Data.Matrix_Error.Matrix_Error diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Column.enso index 6d46a43b8442..ab022ee08302 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Column.enso @@ -18,7 +18,6 @@ import project.Internal.Java_Problems import project.Internal.Naming_Helpers.Naming_Helpers import project.Internal.Parse_Values_Helper import project.Internal.Widget_Helpers -import project.Data.Type.Value_Type_Helpers from project.Internal.Column_Format import all from project.Data.Table import print_table diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Parse_To_Table.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Parse_To_Table.enso index a0a93522ee35..784a20e7da6c 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Parse_To_Table.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Parse_To_Table.enso @@ -4,18 +4,12 @@ import project.Data.Column.Column import project.Data.Data_Formatter.Data_Formatter import project.Data.Table.Table import project.Internal.Unique_Name_Strategy.Unique_Name_Strategy -import Standard.Base.Data.Text.Regex -import Standard.Base.Data.Text.Regex.Pattern -import Standard.Base.Data.Text.Regex.Match.Match import Standard.Base.Data.Text.Regex.Regex_Syntax_Error import Standard.Base.Errors.Common.Type_Error import Standard.Base.Errors.Illegal_Argument.Illegal_Argument -import Standard.Base.Errors.Problem_Behavior.Problem_Behavior -import Standard.Base.Function.Function from project import Value_Type from project.Errors import Duplicate_Output_Column_Names -from Standard.Base.Errors.Problem_Behavior.Problem_Behavior import all ## PRIVATE diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Split_Tokenize.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Split_Tokenize.enso index 2a65ee6f0670..8de2630c7937 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Split_Tokenize.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Split_Tokenize.enso @@ -6,10 +6,8 @@ import project.Data.Type.Value_Type.Value_Type import project.Internal.Java_Exports import project.Internal.Problem_Builder.Problem_Builder import project.Internal.Unique_Name_Strategy.Unique_Name_Strategy -import Standard.Base.Data.Text.Regex import Standard.Base.Data.Text.Regex.Pattern.Pattern -from project import Value_Type from project.Errors import Column_Count_Exceeded, Column_Count_Mismatch, Duplicate_Output_Column_Names, Invalid_Value_Type, Missing_Input_Columns from project.Internal.Java_Exports import make_string_builder diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Vector_Builder.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Vector_Builder.enso index ab73d81b51e1..1b04a5c3a196 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Vector_Builder.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Vector_Builder.enso @@ -1,5 +1,4 @@ from Standard.Base import all -import Standard.Base.Data.Array.Array from project.Internal.Vector_Builder.Vector_Builder import Leaf, Append diff --git a/distribution/lib/Standard/Test/0.0.0-dev/src/Faker.enso b/distribution/lib/Standard/Test/0.0.0-dev/src/Faker.enso index 6b97c6897c70..8eb16ae79827 100644 --- a/distribution/lib/Standard/Test/0.0.0-dev/src/Faker.enso +++ b/distribution/lib/Standard/Test/0.0.0-dev/src/Faker.enso @@ -1,6 +1,6 @@ from Standard.Base import all -polyglot java import java.util.Random +polyglot java import java.util.Random as Java_Random polyglot java import org.enso.base.Text_Utils ## Object to generate (deterministic) random value for testing @@ -17,7 +17,7 @@ type Faker - seed: Optional seed value to make the sequence deterministic new : Integer -> Faker new (seed = 0) = - generator = if seed == 0 then Random.new else Random.new seed + generator = if seed == 0 then Java_Random.new else Java_Random.new seed Faker.Value generator Value generator diff --git a/distribution/lib/Standard/Test/0.0.0-dev/src/Main.enso b/distribution/lib/Standard/Test/0.0.0-dev/src/Main.enso index 63bd39c495d1..0298c3b1ce8c 100644 --- a/distribution/lib/Standard/Test/0.0.0-dev/src/Main.enso +++ b/distribution/lib/Standard/Test/0.0.0-dev/src/Main.enso @@ -5,11 +5,11 @@ import project.Faker.Faker import project.Problems import project.Test_Suite.Test_Suite import project.Test.Test -import project.Extensions +from project.Extensions import all export project.Bench.Bench export project.Faker.Faker export project.Problems export project.Test_Suite.Test_Suite export project.Test.Test -export project.Extensions +from project.Extensions import all diff --git a/distribution/lib/Standard/Test/0.0.0-dev/src/Problems.enso b/distribution/lib/Standard/Test/0.0.0-dev/src/Problems.enso index 6d45e96f4b04..0f180270eafa 100644 --- a/distribution/lib/Standard/Test/0.0.0-dev/src/Problems.enso +++ b/distribution/lib/Standard/Test/0.0.0-dev/src/Problems.enso @@ -1,7 +1,7 @@ from Standard.Base import all from project import Test -import project.Extensions +from project.Extensions import all ## Returns values of warnings attached to the value. get_attached_warnings v = diff --git a/distribution/lib/Standard/Visualization/0.0.0-dev/src/Table.enso b/distribution/lib/Standard/Visualization/0.0.0-dev/src/Table.enso index 978b65c00609..3d23f9d854d4 100644 --- a/distribution/lib/Standard/Visualization/0.0.0-dev/src/Table.enso +++ b/distribution/lib/Standard/Visualization/0.0.0-dev/src/Table.enso @@ -1,6 +1,5 @@ from Standard.Base import all -from Standard.Base.Data.Text.Extensions import slice_text from Standard.Visualization.Text import get_chunk_from_line import Standard.Base.Errors.Common.Not_Found import Standard.Table as Table_Module diff --git a/distribution/lib/Standard/Visualization/0.0.0-dev/src/Text.enso b/distribution/lib/Standard/Visualization/0.0.0-dev/src/Text.enso index c92203244f88..88da2f8614a0 100644 --- a/distribution/lib/Standard/Visualization/0.0.0-dev/src/Text.enso +++ b/distribution/lib/Standard/Visualization/0.0.0-dev/src/Text.enso @@ -1,7 +1,5 @@ from Standard.Base import all -from Standard.Base.Data.Text.Extensions import slice_text - ## PRIVATE Message to be sent to the IDE. type Message diff --git a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/execution/JobExecutionEngine.scala b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/execution/JobExecutionEngine.scala index 5977a76d1c61..a193503b9332 100644 --- a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/execution/JobExecutionEngine.scala +++ b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/execution/JobExecutionEngine.scala @@ -12,7 +12,7 @@ import java.util.logging.Level import scala.concurrent.{Future, Promise} import scala.util.control.NonFatal -/** This component schedules the execution of jobs. It keep a queue of +/** This component schedules the execution of jobs. It keeps a queue of * pending jobs and activates job execution in FIFO order. * * @param interpreterContext suppliers of services that provide interpreter diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/BuiltinTypesTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/BuiltinTypesTest.scala index 883f8481ec14..2f339c31199b 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/BuiltinTypesTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/BuiltinTypesTest.scala @@ -359,11 +359,10 @@ class BuiltinTypesTest val requestId = UUID.randomUUID() val metadata = new Metadata - val idMain = metadata.addItem(75, 34) + val idMain = metadata.addItem(47, 34) val code = - """from Standard.Base import all - |import Standard.Base.Data.Array.Array + """from Standard.Base import Vector, Array | |main = | Vector.from_array Array.empty diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/Module.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/Module.java index 2a9ca0ef49c8..837afc11d55f 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/Module.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/Module.java @@ -100,6 +100,13 @@ public boolean isBefore(CompilationStage stage) { private boolean wasLoadedFromCache; private boolean hasCrossModuleLinks; private final boolean synthetic; + /** + * This list is filled in case there is a directory with the same name as this module. The + * directory then contains submodules of this module that should be directly accessible from this + * module - achieved by both filling in this list, and inserting synthetic imports and exports + * into this module - See {@link + * org.enso.compiler.Compiler#injectSyntheticModuleExports(IR.Module, List)}. + */ private List directModulesRefs; /** diff --git a/engine/runtime/src/main/scala/org/enso/compiler/Passes.scala b/engine/runtime/src/main/scala/org/enso/compiler/Passes.scala index 54b4cf181a4e..4a0501212646 100644 --- a/engine/runtime/src/main/scala/org/enso/compiler/Passes.scala +++ b/engine/runtime/src/main/scala/org/enso/compiler/Passes.scala @@ -47,6 +47,7 @@ class Passes( OperatorToFunction, LambdaShorthandToLambda, ImportSymbolAnalysis, + AmbiguousImportsAnalysis, ShadowedPatternFields, UnreachableMatchBranches, NestedPatternMatch, diff --git a/engine/runtime/src/main/scala/org/enso/compiler/core/IR.scala b/engine/runtime/src/main/scala/org/enso/compiler/core/IR.scala index 8a4cb1b1e797..0dd4f2e1ba3f 100644 --- a/engine/runtime/src/main/scala/org/enso/compiler/core/IR.scala +++ b/engine/runtime/src/main/scala/org/enso/compiler/core/IR.scala @@ -9,9 +9,9 @@ import org.enso.compiler.exception.CompilerError import org.enso.compiler.pass.IRPass import org.enso.interpreter.epb.EpbParser import org.enso.syntax.text.{Debug, Location} +import com.oracle.truffle.api.source.Source import java.util.UUID - import scala.annotation.unused /** [[IR]] is a temporary and fairly unsophisticated internal representation @@ -198,6 +198,20 @@ object IR { " " * n } + private def fileLocationFromSection( + loc: IR.IdentifiedLocation, + source: Source + ): String = { + val section = + source.createSection(loc.location.start, loc.location.length) + val locStr = + "" + section.getStartLine + ":" + + section.getStartColumn + "-" + + section.getEndLine + ":" + + section.getEndColumn + source.getName + "[" + locStr + "]" + } + /** The size of a single indentation level. */ val indentLevel: Int = 4 @@ -6999,6 +7013,25 @@ object IR { } } + case class DuplicatedImport( + override val location: Option[IdentifiedLocation], + originalImport: IR.Module.Scope.Import, + symbolName: String, + source: Source + ) extends Warning { + override def message: String = { + val originalImportRepr = + originalImport.location match { + case Some(location) => + s"'${originalImport.showCode()}' in ${fileLocationFromSection(location, source)}" + case None => originalImport.showCode() + } + s"Duplicated import of $symbolName. The original import is ${originalImportRepr}." + } + + override def diagnosticKeys(): Array[Any] = Array() + } + /** A warning about a `@Tail_Call` annotation placed in a non-tail * position. * @param location the location of the annotated application @@ -8815,6 +8848,34 @@ object IR { override def message: String = s"No such constructor ${constructorName} in type $typeName" } + + /** Represents an ambiguous import resolution error, where the same symbol is imported more than once refereing + * to different objects. The objects are represented by their physical path in the project. + * @param originalImport the original import statement. + * @param originalSymbolPath the original symbol path. + * @param symbolName the symbol name that is ambiguous. + * @param symbolPath the symbol path that is different than [[originalSymbolPath]]. + * @param source Location of the original import. + */ + case class AmbiguousImport( + originalImport: IR.Module.Scope.Import, + originalSymbolPath: String, + symbolName: String, + symbolPath: String, + source: Source + ) extends Reason { + override def message: String = { + val originalImportRepr = + originalImport.location match { + case Some(location) => + fileLocationFromSection(location, source) + case None => originalImport.showCode() + } + s"Symbol '$symbolName' resolved ambiguously to '$symbolPath' in the import Statement. " + + s"The symbol was first resolved to '$originalSymbolPath' in the import statement '$originalImportRepr'." + } + + } } /** An erroneous import or export statement. diff --git a/engine/runtime/src/main/scala/org/enso/compiler/pass/analyse/AmbiguousImportsAnalysis.scala b/engine/runtime/src/main/scala/org/enso/compiler/pass/analyse/AmbiguousImportsAnalysis.scala new file mode 100644 index 000000000000..4801e70b05ee --- /dev/null +++ b/engine/runtime/src/main/scala/org/enso/compiler/pass/analyse/AmbiguousImportsAnalysis.scala @@ -0,0 +1,420 @@ +package org.enso.compiler.pass.analyse + +import org.enso.interpreter.runtime.Module +import org.enso.compiler.context.{InlineContext, ModuleContext} +import org.enso.compiler.core.IR +import org.enso.compiler.core.IR.Module.Scope.Import +import org.enso.compiler.core.IR.Module.Scope.Import.Polyglot +import org.enso.compiler.data.BindingsMap +import org.enso.compiler.exception.CompilerError +import org.enso.compiler.pass.IRPass + +import scala.collection.mutable +import scala.collection.mutable.ListBuffer + +/** A pass that checks for ambiguous and duplicated symbols from imports. + * A duplicated import is an import of a symbol that has already been imported and refers to the + * same object (entity). On the other hand, an ambiguous import is an import of a symbol that has already + * been imported but refers to a different object. For every duplicated import, a warning is attached + * to the IR, and for every ambiguous import, the IR is replaced with an error. + * To identify an object, this pass uses physical path of the object instead of the object itself. + * + * One import IR can be replaced with multiple error IRs. This is the case for `from ... import ...` + * import statements. + * + * The original import is saved in the error and warning so that the user can see from which location + * the symbol was originally imported. + * + * Also iterates polyglot imports. + * + * All synthetic imports and exports, as well as synthetic modules are ignored by this pass. + * + * This pass does not alter any metadata. + */ +case object AmbiguousImportsAnalysis extends IRPass { + + override type Metadata = IRPass.Metadata.Empty + + override type Config = IRPass.Configuration.Default + + override val precursorPasses: Seq[IRPass] = + Seq(BindingAnalysis, ImportSymbolAnalysis) + + override val invalidatedPasses: Seq[IRPass] = + Seq() + + /** @inheritdoc + */ + override def runExpression( + ir: IR.Expression, + inlineContext: InlineContext + ): IR.Expression = ir + + /** @inheritdoc + */ + override def updateMetadataInDuplicate[T <: IR](sourceIr: T, copyOfIr: T): T = + copyOfIr + + /** @inheritdoc + */ + override def runModule( + ir: IR.Module, + moduleContext: ModuleContext + ): IR.Module = { + val module = moduleContext.module + if (module.isSynthetic) { + ir + } else { + val bindingMap = ir.unsafeGetMetadata( + BindingAnalysis, + "BindingMap should already be present" + ) + val encounteredSymbols = new EncounteredSymbols() + ir.copy( + imports = ir.imports.flatMap(imp => { + analyseAmbiguousSymbols( + imp, + module, + bindingMap, + encounteredSymbols + ).fold(identity, imp => List(imp)) + }) + ) + } + } + + /** Analyses ambiguous symbols in the given import. + * @param imp current import + * @param module current module + * @param bindingMap binding map of the current module + * @return A list of errors, if any encountered, or an import IR, potentially with some + * warnings attached. + */ + private def analyseAmbiguousSymbols( + imp: IR.Module.Scope.Import, + module: Module, + bindingMap: BindingsMap, + encounteredSymbols: EncounteredSymbols + ): Either[List[IR.Error.ImportExport], IR.Module.Scope.Import] = { + imp match { + // Import multiple symbols + case moduleImport @ IR.Module.Scope.Import.Module( + _, + _, + _, + Some(onlyNames), + _, + _, + false, + _, + _ + ) => + getImportTarget(moduleImport, bindingMap) match { + case Some(importTarget) => + val encounteredErrors: ListBuffer[IR.Error.ImportExport] = + ListBuffer() + val imp = + onlyNames.foldLeft(moduleImport: IR.Module.Scope.Import) { + case (imp, symbol) => + val symbolName = symbol.name + importTarget.resolveExportedSymbol(symbolName) match { + case Right(resolvedName) => + val symbolPath = resolvedName.qualifiedName.toString + tryAddEncounteredSymbol( + module, + encounteredSymbols, + imp, + symbolName, + symbolPath + ) match { + case Left(error) => + encounteredErrors += error + imp + case Right(imp) => imp + } + case Left(resolutionError) => + throw new CompilerError( + s"Unreachable: (should have been resolved in previous passes) $resolutionError" + ) + } + } + if (encounteredErrors.nonEmpty) { + Left(encounteredErrors.toList) + } else { + Right(imp) + } + + case None => + Right(moduleImport) + } + + // Import all symbols + case moduleImport @ IR.Module.Scope.Import.Module( + _, + _, + true, + _, + hiddenNames, + _, + false, + _, + _ + ) => + getImportTarget(moduleImport, bindingMap) match { + case Some(importTarget) => + // Names of the symbols that are exported by a module or a type referred to via importTarget + val exportedSymbolNames: List[String] = + importTarget.exportedSymbols.keySet.toList + val symbolsToIterate = hiddenNames match { + case None => exportedSymbolNames + case Some(hiddenNamesLiterals) => + val hiddenNames = hiddenNamesLiterals.map(_.name) + exportedSymbolNames.filterNot(hiddenNames.contains) + } + val encounteredErrors: ListBuffer[IR.Error.ImportExport] = + ListBuffer() + val imp = + symbolsToIterate.foldLeft(moduleImport: IR.Module.Scope.Import) { + case (imp, symbolName) => + importTarget.resolveExportedSymbol(symbolName) match { + case Left(resolutionError) => + throw new CompilerError( + s"Unreachable: (should have been resolved in previous passes) $resolutionError" + ) + case Right(resolvedName) => + tryAddEncounteredSymbol( + module, + encounteredSymbols, + imp, + symbolName, + resolvedName.qualifiedName.toString + ) match { + case Left(error) => + encounteredErrors += error + imp + case Right(imp) => imp + } + } + } + if (encounteredErrors.nonEmpty) { + Left(encounteredErrors.toList) + } else { + Right(imp) + } + + case None => + Right(moduleImport) + } + + // Import a renamed symbol + case moduleImport @ IR.Module.Scope.Import.Module( + importPath, + Some(rename), + _, + _, + _, + _, + false, + _, + _ + ) => + val symbolPath = importPath.name + tryAddEncounteredSymbol( + module, + encounteredSymbols, + moduleImport, + rename.name, + symbolPath + ) match { + case Left(error) => Left(List(error)) + case Right(imp) => Right(imp) + } + + // Import one symbol + case moduleImport @ IR.Module.Scope.Import.Module( + importPath, + _, + _, + _, + _, + _, + false, + _, + _ + ) => + tryAddEncounteredSymbol( + module, + encounteredSymbols, + moduleImport, + importPath.parts.last.name, + importPath.name + ) match { + case Left(err) => Left(List(err)) + case Right(imp) => Right(imp) + } + + // Polyglot import + case polyImport @ Import.Polyglot(entity, rename, _, _, _) => + val symbolName = rename.getOrElse(entity.getVisibleName) + val symbolPath = entity match { + case Polyglot.Java(packageName, className) => + packageName + "." + className + } + tryAddEncounteredSymbol( + module, + encounteredSymbols, + polyImport, + symbolName, + symbolPath + ) match { + case Left(err) => Left(List(err)) + case Right(imp) => Right(imp) + } + + case _ => Right(imp) + } + } + + private def getImportTarget( + imp: IR.Module.Scope.Import, + bindingMap: BindingsMap + ): Option[BindingsMap.ImportTarget] = { + bindingMap.resolvedImports.find(_.importDef == imp) match { + case Some(resolvedImport) => + Some(resolvedImport.target) + case None => + None + } + } + + /** Tries to add the encountered symbol to the encountered symbols map. If it is already contained + * in the map, checks whether the underlying entity path is the same as the original entity path. + * Based on that, either attaches a warning for a duplicated import, or returns an [[IR.Error.ImportExport]]. + * + * @param module Current module + * @param encounteredSymbols Encountered symbols in the current module + * @param currentImport Currently iterated import + * @param symbolName Name of the symbol that is about to be processed + * @param symbolPath physical path of the symbol that is about to be processed + * @return + */ + private def tryAddEncounteredSymbol( + module: Module, + encounteredSymbols: EncounteredSymbols, + currentImport: IR.Module.Scope.Import, + symbolName: String, + symbolPath: String + ): Either[IR.Error.ImportExport, IR.Module.Scope.Import] = { + if (encounteredSymbols.containsSymbol(symbolName)) { + val encounteredFullName = + encounteredSymbols.getPathForSymbol(symbolName) + val originalImport = + encounteredSymbols.getOriginalImportForSymbol(symbolName).get + if (symbolPath == encounteredFullName) { + val warn = + createWarningForDuplicatedImport( + module, + originalImport, + currentImport, + symbolName + ) + Right(currentImport.addDiagnostic(warn)) + } else { + Left( + createErrorForAmbiguousImport( + module, + originalImport, + encounteredFullName, + currentImport, + symbolName, + symbolPath + ) + ) + } + } else { + encounteredSymbols.addSymbol(currentImport, symbolName, symbolPath) + Right(currentImport) + } + } + + private def createErrorForAmbiguousImport( + module: Module, + originalImport: IR.Module.Scope.Import, + originalSymbolPath: String, + duplicatingImport: IR.Module.Scope.Import, + ambiguousSymbol: String, + ambiguousSymbolPath: String + ): IR.Error.ImportExport = { + IR.Error.ImportExport( + duplicatingImport, + IR.Error.ImportExport.AmbiguousImport( + originalImport, + originalSymbolPath, + ambiguousSymbol, + ambiguousSymbolPath, + module.getSource + ) + ) + } + + private def createWarningForDuplicatedImport( + module: Module, + originalImport: IR.Module.Scope.Import, + duplicatingImport: IR.Module.Scope.Import, + duplicatedSymbol: String + ): IR.Warning = { + IR.Warning.DuplicatedImport( + duplicatingImport.location, + originalImport, + duplicatedSymbol, + module.getSource + ) + } + + /** For every encountered symbol name, we keep track of the original import from which it was imported, + * along with the entity path. The entity path is vital to decide whether an imported symbol is duplicated + * or ambiguous. + */ + private class EncounteredSymbols( + private val encounteredSymbols: mutable.Map[ + String, + (IR.Module.Scope.Import, String) + ] = mutable.HashMap.empty + ) { + + def containsSymbol(symbolName: String): Boolean = { + encounteredSymbols.contains(symbolName) + } + + /** @param imp Import where the symbol is located + */ + def addSymbol( + imp: IR.Module.Scope.Import, + symbol: String, + symbolPath: String + ): Unit = { + encounteredSymbols.put(symbol, (imp, symbolPath)) + } + + /** Returns the entity path for the symbol. + */ + def getPathForSymbol( + symbol: String + ): String = { + encounteredSymbols.get(symbol) match { + case Some((_, fullName)) => + fullName + case None => + throw new IllegalStateException("unreachable") + } + } + + /** Returns the original import from which the symbol was imported, if any. + */ + def getOriginalImportForSymbol( + symbol: String + ): Option[IR.Module.Scope.Import] = { + encounteredSymbols.get(symbol).map(_._1) + } + } +} diff --git a/engine/runtime/src/test/scala/org/enso/compiler/test/PassesTest.scala b/engine/runtime/src/test/scala/org/enso/compiler/test/PassesTest.scala index 694ed02e3e0d..e1cf83984254 100644 --- a/engine/runtime/src/test/scala/org/enso/compiler/test/PassesTest.scala +++ b/engine/runtime/src/test/scala/org/enso/compiler/test/PassesTest.scala @@ -6,6 +6,7 @@ import org.enso.compiler.core.IR import org.enso.compiler.pass.IRPass import org.enso.compiler.pass.analyse.{ AliasAnalysis, + AmbiguousImportsAnalysis, BindingAnalysis, ImportSymbolAnalysis } @@ -62,6 +63,7 @@ class PassesTest extends CompilerTest { OperatorToFunction, LambdaShorthandToLambda, ImportSymbolAnalysis, + AmbiguousImportsAnalysis, ShadowedPatternFields, UnreachableMatchBranches, NestedPatternMatch, diff --git a/engine/runtime/src/test/scala/org/enso/compiler/test/semantic/ImportExportTest.scala b/engine/runtime/src/test/scala/org/enso/compiler/test/semantic/ImportExportTest.scala index 95b3a224d0bc..fb2618c411dd 100644 --- a/engine/runtime/src/test/scala/org/enso/compiler/test/semantic/ImportExportTest.scala +++ b/engine/runtime/src/test/scala/org/enso/compiler/test/semantic/ImportExportTest.scala @@ -457,6 +457,287 @@ class ImportExportTest } } + "Ambiguous symbol resolution" should { + "generate warning when importing same type twice with different import statements" in { + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + val mainIr = + s""" + |import $namespace.$packageName.A_Module.A_Type + |from $namespace.$packageName.A_Module import A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 2 + val origImport = mainIr.imports(0) + val warn = mainIr + .imports(1) + .diagnostics + .collect({ case w: IR.Warning.DuplicatedImport => w }) + warn.size shouldEqual 1 + warn.head.originalImport shouldEqual origImport + warn.head.symbolName shouldEqual "A_Type" + warn.head.originalImport shouldEqual origImport + } + + "generate warning when importing same type twice with one-symbol import and all-symbol import" in { + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + val mainIr = + s""" + |import $namespace.$packageName.A_Module.A_Type + |from $namespace.$packageName.A_Module import all + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 2 + val origImport = mainIr.imports(0) + val warn = mainIr + .imports(1) + .diagnostics + .collect({ case w: IR.Warning.DuplicatedImport => w }) + warn.size shouldEqual 1 + warn.head.originalImport shouldEqual origImport + warn.head.symbolName shouldEqual "A_Type" + warn.head.originalImport shouldEqual origImport + } + + "generate warning when importing same type twice with two all-symbol imports" in { + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + val mainIr = + s""" + |from $namespace.$packageName.A_Module import all + |from $namespace.$packageName.A_Module import all + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 2 + val origImport = mainIr.imports(0) + val warn = mainIr + .imports(1) + .diagnostics + .collect({ case w: IR.Warning.DuplicatedImport => w }) + warn.size shouldEqual 1 + warn.head.originalImport shouldEqual origImport + warn.head.symbolName shouldEqual "A_Type" + warn.head.originalImport shouldEqual origImport + } + + "generate two warnings when importing same type twice with two all-symbol imports" in { + s""" + |type A_Type + |type AA_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + val mainIr = + s""" + |from $namespace.$packageName.A_Module import all + |from $namespace.$packageName.A_Module import all + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 2 + val origImport = mainIr.imports(0) + val warn = mainIr + .imports(1) + .diagnostics + .collect({ case w: IR.Warning.DuplicatedImport => w }) + warn.size shouldEqual 2 + warn.foreach(_.originalImport shouldEqual origImport) + warn.exists(_.symbolName == "A_Type") shouldEqual true + warn.exists(_.symbolName == "AA_Type") shouldEqual true + } + + "work when importing two different types with hiding" in { + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("B_Module")) + val mainIr = + s""" + |from $namespace.$packageName.A_Module import all hiding A_Type + |from $namespace.$packageName.B_Module import all + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 2 + mainIr.imports.foreach( + _.isInstanceOf[IR.Error.ImportExport] shouldEqual false + ) + } + + "result in error when importing same type twice with two one-symbol import and renamed import" in { + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + s""" + |type B_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("B_Module")) + val mainIr = + s""" + |from $namespace.$packageName.A_Module import A_Type + |import $namespace.$packageName.B_Module.B_Type as A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 2 + val origImport = mainIr.imports(0) + val ambiguousImport = mainIr + .imports(1) + .asInstanceOf[IR.Error.ImportExport] + .reason + .asInstanceOf[IR.Error.ImportExport.AmbiguousImport] + ambiguousImport.symbolName shouldEqual "A_Type" + ambiguousImport.originalImport shouldEqual origImport + } + + "generate warning when importing same type twice in one import statement" in { + s""" + |type A_Type + |static_method = 42 + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + val mainIr = + s""" + |from $namespace.$packageName.A_Module import A_Type, static_method, A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + val warns = mainIr + .imports(0) + .diagnostics + .collect({ case w: IR.Warning.DuplicatedImport => w }) + warns.size shouldEqual 1 + warns.head.symbolName shouldEqual "A_Type" + } + + "generate error when importing different type twice with one-symbol import and renamed polyglot import" in { + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + val mainIr = + s""" + |from $namespace.$packageName.A_Module import A_Type + |polyglot java import org.enso.example.TestClass as A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 2 + val origImport = mainIr.imports(0) + val ambiguousImport = mainIr + .imports(1) + .asInstanceOf[IR.Error.ImportExport] + .reason + .asInstanceOf[IR.Error.ImportExport.AmbiguousImport] + ambiguousImport.symbolName shouldEqual "A_Type" + ambiguousImport.originalImport shouldEqual origImport + } + + "generate warning when importing same type twice with two renamed polyglot imports" in { + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + val mainIr = + s""" + |polyglot java import org.enso.example.TestClass as A_Type + |polyglot java import org.enso.example.TestClass as A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 2 + val origImport = mainIr.imports(0) + val warns = mainIr + .imports(1) + .diagnostics + .collect({ case w: IR.Warning.DuplicatedImport => w }) + warns.size shouldEqual 1 + warns.head.symbolName shouldEqual "A_Type" + warns.head.originalImport shouldEqual origImport + } + + "result in error when importing different polyglot types with two renamed polyglot imports" in { + val mainIr = + s""" + |polyglot java import org.enso.example.TestClass as A_Type + |polyglot java import org.enso.example.TestClass.StaticInnerClass as A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 2 + val origImport = mainIr.imports(0) + val ambiguousImport = mainIr + .imports(1) + .asInstanceOf[IR.Error.ImportExport] + .reason + .asInstanceOf[IR.Error.ImportExport.AmbiguousImport] + ambiguousImport.symbolName shouldEqual "A_Type" + ambiguousImport.originalImport shouldEqual origImport + } + + "generate warnings when importing same type multiple times with one-symbol import statements" in { + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + val mainIr = + s""" + |import $namespace.$packageName.A_Module.A_Type + |import $namespace.$packageName.A_Module.A_Type + |import $namespace.$packageName.A_Module.A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 3 + val origImport = mainIr.imports(0) + val allWarns = + mainIr.imports.flatMap(_.diagnostics.collect({ + case w: IR.Warning.DuplicatedImport => w + })) + allWarns.size shouldEqual 2 + allWarns.foreach(_.symbolName shouldEqual "A_Type") + allWarns.foreach(_.originalImport shouldEqual origImport) + } + + "generate warnings when importing same type multiple times with import-all statements" in { + s""" + |type A_Type + |""".stripMargin + .createModule(packageQualifiedName.createChild("A_Module")) + val mainIr = + s""" + |from $namespace.$packageName.A_Module import all + |from $namespace.$packageName.A_Module import all + |from $namespace.$packageName.A_Module import all + |""".stripMargin + .createModule(packageQualifiedName.createChild("Main_Module")) + .getIr + mainIr.imports.size shouldEqual 3 + val origImport = mainIr.imports(0) + val allWarns = + mainIr.imports.flatMap(_.diagnostics.collect({ + case w: IR.Warning.DuplicatedImport => w + })) + allWarns.size shouldEqual 2 + allWarns.foreach(_.symbolName shouldEqual "A_Type") + allWarns.foreach(_.originalImport shouldEqual origImport) + } + } + "Import resolution for three modules" should { "not resolve symbol that is not explicitly exported" in { diff --git a/test/Benchmarks/src/Collections.enso b/test/Benchmarks/src/Collections.enso index 9a343eaa0cca..a23dcbf4929e 100644 --- a/test/Benchmarks/src/Collections.enso +++ b/test/Benchmarks/src/Collections.enso @@ -2,7 +2,7 @@ from Standard.Base import all from Standard.Test import Bench -polyglot java import java.util.Random +polyglot java import java.util.Random as Java_Random gen_list len = 0.up_to len . fold List.Nil (l -> i -> List.Cons i+1 l) @@ -19,7 +19,7 @@ sum_list_meta list = sum_recur n = if n == 0 then 0 else 1 + sum_recur n-1 build_map size = - rand = Random.new + rand = Java_Random.new 0.up_to size . fold Map.empty (m -> i -> m.insert (rand.nextInt 10000) i) bench = diff --git a/test/Benchmarks/src/Equality.enso b/test/Benchmarks/src/Equality.enso index 80ddee820b51..1cb4f9f4ded3 100644 --- a/test/Benchmarks/src/Equality.enso +++ b/test/Benchmarks/src/Equality.enso @@ -3,7 +3,6 @@ import Standard.Base.Errors.Illegal_State.Illegal_State from Standard.Test import Bench -polyglot java import java.util.Random polyglot java import org.graalvm.collections.Pair as Graal_Pair type Uniform_Type diff --git a/test/Benchmarks/src/Table/Aggregate.enso b/test/Benchmarks/src/Table/Aggregate.enso index 745433943ec5..7057660b0b16 100644 --- a/test/Benchmarks/src/Table/Aggregate.enso +++ b/test/Benchmarks/src/Table/Aggregate.enso @@ -1,4 +1,4 @@ -from Standard.Base import all +from Standard.Base import all hiding First, Last from Standard.Table import Table from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all diff --git a/test/Benchmarks/src/Time/Work_Days.enso b/test/Benchmarks/src/Time/Work_Days.enso index 84f4c5a8d5dd..a5af20483d0c 100644 --- a/test/Benchmarks/src/Time/Work_Days.enso +++ b/test/Benchmarks/src/Time/Work_Days.enso @@ -2,8 +2,6 @@ from Standard.Base import all from Standard.Test import Bench -polyglot java import java.util.Random - bench = iter_size = 50 num_iterations = 10 diff --git a/test/Benchmarks/src/Vector/Array_Proxy_Bench.enso b/test/Benchmarks/src/Vector/Array_Proxy_Bench.enso index 7174fe195236..80bfdbebae05 100644 --- a/test/Benchmarks/src/Vector/Array_Proxy_Bench.enso +++ b/test/Benchmarks/src/Vector/Array_Proxy_Bench.enso @@ -2,7 +2,6 @@ from Standard.Base import all from Standard.Test import Bench -import Standard.Base.Data.Vector.Vector import Standard.Base.Data.Array_Proxy.Array_Proxy sum arr = diff --git a/test/Benchmarks/src/Vector/Distinct.enso b/test/Benchmarks/src/Vector/Distinct.enso index dcc91f8dfdee..0fc5a4e91c87 100644 --- a/test/Benchmarks/src/Vector/Distinct.enso +++ b/test/Benchmarks/src/Vector/Distinct.enso @@ -5,7 +5,6 @@ from Standard.Test import Bench import project.Vector.Utils -polyglot java import java.util.Random polyglot java import org.enso.base.Time_Utils diff --git a/test/Benchmarks/src/Vector/Operations.enso b/test/Benchmarks/src/Vector/Operations.enso index 4c428c621d55..bfe31103f89c 100644 --- a/test/Benchmarks/src/Vector/Operations.enso +++ b/test/Benchmarks/src/Vector/Operations.enso @@ -6,7 +6,7 @@ from Standard.Test import Bench import project.Vector.Utils -polyglot java import java.util.Random +polyglot java import java.util.Random as Java_Random ## Bench Utilities ============================================================ @@ -19,7 +19,7 @@ num_iterations = 10 bench = random_vec = Utils.make_random_vec vector_size random_vec_2 = Utils.make_random_vec 100000 - random_gen = Random.new 123456 + random_gen = Java_Random.new 123456 Bench.measure (Base.Vector.new vector_size i->i) "New Vector" iter_size num_iterations Bench.measure (Base.Vector.new vector_size _->42) "New Constant" iter_size num_iterations diff --git a/test/Benchmarks/src/Vector/Sort.enso b/test/Benchmarks/src/Vector/Sort.enso index 3c7795015e52..7c61314d04d8 100644 --- a/test/Benchmarks/src/Vector/Sort.enso +++ b/test/Benchmarks/src/Vector/Sort.enso @@ -5,7 +5,7 @@ from Standard.Test import Bench import project.Vector.Utils -polyglot java import java.util.Random +polyglot java import java.util.Random as Java_Random polyglot java import org.enso.base.Time_Utils @@ -21,7 +21,7 @@ make_sorted_ascending_vec n = 0.up_to n+1 . to_vector make_partially_sorted_vec : Integer -> Vector make_partially_sorted_vec n = - random_gen = Random.new n + random_gen = Java_Random.new n direction = Ref.new Sort_Direction.Ascending last_num = Ref.new 0 run_length = Ref.new 0 diff --git a/test/Benchmarks/src/Vector/Utils.enso b/test/Benchmarks/src/Vector/Utils.enso index 2cadbdba633d..9e13a53bac0b 100644 --- a/test/Benchmarks/src/Vector/Utils.enso +++ b/test/Benchmarks/src/Vector/Utils.enso @@ -1,8 +1,8 @@ from Standard.Base import all -polyglot java import java.util.Random +polyglot java import java.util.Random as Java_Random make_random_vec : Integer -> Vector make_random_vec n = - random_gen = Random.new n + random_gen = Java_Random.new n Vector.fill n random_gen.nextLong diff --git a/test/Table_Tests/src/Common_Table_Operations/Join/Join_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Join/Join_Spec.enso index e3b509a4073c..aca32726a746 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Join/Join_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Join/Join_Spec.enso @@ -3,7 +3,6 @@ import Standard.Base.Errors.Illegal_State.Illegal_State from Standard.Table import all hiding Table from Standard.Table.Errors import all -import Standard.Table.Data.Type.Value_Type.Value_Type from Standard.Database.Errors import Unsupported_Database_Operation diff --git a/test/Table_Tests/src/Common_Table_Operations/Join/Union_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Join/Union_Spec.enso index b9c3b5afd964..91e6440caf73 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Join/Union_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Join/Union_Spec.enso @@ -2,7 +2,6 @@ from Standard.Base import all from Standard.Table import all from Standard.Table.Errors import all -import Standard.Table.Data.Type.Value_Type.Value_Type from Standard.Database.Errors import Unsupported_Database_Operation diff --git a/test/Table_Tests/src/Common_Table_Operations/Join/Zip_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Join/Zip_Spec.enso index e8fb5c328fee..5011cf4095c3 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Join/Zip_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Join/Zip_Spec.enso @@ -3,7 +3,6 @@ import Standard.Base.Errors.Illegal_State.Illegal_State from Standard.Table import all hiding Table from Standard.Table.Errors import all -import Standard.Table.Data.Type.Value_Type.Value_Type from Standard.Database.Errors import Unsupported_Database_Operation diff --git a/test/Table_Tests/src/Database/Codegen_Spec.enso b/test/Table_Tests/src/Database/Codegen_Spec.enso index 16d6cdc5ca7d..7bce900d5a90 100644 --- a/test/Table_Tests/src/Database/Codegen_Spec.enso +++ b/test/Table_Tests/src/Database/Codegen_Spec.enso @@ -2,7 +2,7 @@ from Standard.Base import all import Standard.Base.Errors.Illegal_State.Illegal_State from Standard.Table import Sort_Column -from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all +from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all hiding First, Last from Standard.Table.Errors import No_Input_Columns_Selected, Missing_Input_Columns, No_Such_Column from Standard.Database import all diff --git a/test/Table_Tests/src/Database/Common_Spec.enso b/test/Table_Tests/src/Database/Common_Spec.enso index 4f1ca3ab5f25..7d9c6584807c 100644 --- a/test/Table_Tests/src/Database/Common_Spec.enso +++ b/test/Table_Tests/src/Database/Common_Spec.enso @@ -2,7 +2,7 @@ from Standard.Base import all import Standard.Base.Errors.Illegal_Argument.Illegal_Argument from Standard.Table import Table, Sort_Column -from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all +from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all hiding First, Last from Standard.Table.Errors import all from Standard.Database import all diff --git a/test/Table_Tests/src/Database/Postgres_Spec.enso b/test/Table_Tests/src/Database/Postgres_Spec.enso index 7347644ba361..ec2b13d7e9eb 100644 --- a/test/Table_Tests/src/Database/Postgres_Spec.enso +++ b/test/Table_Tests/src/Database/Postgres_Spec.enso @@ -4,7 +4,7 @@ import Standard.Base.Runtime.Ref.Ref import Standard.Table.Data.Type.Value_Type.Bits from Standard.Table import Table, Value_Type -from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all hiding First +from Standard.Table.Data.Aggregate_Column.Aggregate_Column import all hiding First, Last import Standard.Database.Data.SQL_Type.SQL_Type import Standard.Database.Internal.Postgres.Pgpass diff --git a/test/Table_Tests/src/Database/SQLite_Spec.enso b/test/Table_Tests/src/Database/SQLite_Spec.enso index 0453db287c51..980367c78cbf 100644 --- a/test/Table_Tests/src/Database/SQLite_Spec.enso +++ b/test/Table_Tests/src/Database/SQLite_Spec.enso @@ -5,7 +5,6 @@ import Standard.Base.Errors.File_Error.File_Error import Standard.Table.Data.Type.Value_Type.Bits from Standard.Table import Table, Value_Type -import Standard.Database.Connection.SQLite_Format.SQLite_Format from Standard.Database import all from Standard.Database.Errors import SQL_Error diff --git a/test/Table_Tests/src/In_Memory/Parse_To_Table_Spec.enso b/test/Table_Tests/src/In_Memory/Parse_To_Table_Spec.enso index 47510dfa02bb..eb2c1ab25a2e 100644 --- a/test/Table_Tests/src/In_Memory/Parse_To_Table_Spec.enso +++ b/test/Table_Tests/src/In_Memory/Parse_To_Table_Spec.enso @@ -1,6 +1,5 @@ from Standard.Base import all -import Standard.Base.Data.Text.Case_Sensitivity.Case_Sensitivity import Standard.Base.Data.Text.Regex.Regex_Syntax_Error import Standard.Base.Errors.Illegal_Argument.Illegal_Argument import Standard.Table.Data.Table_Conversions diff --git a/test/Table_Tests/src/In_Memory/Split_Tokenize_Spec.enso b/test/Table_Tests/src/In_Memory/Split_Tokenize_Spec.enso index 47ebbf009280..f9cd354c65e5 100644 --- a/test/Table_Tests/src/In_Memory/Split_Tokenize_Spec.enso +++ b/test/Table_Tests/src/In_Memory/Split_Tokenize_Spec.enso @@ -1,6 +1,5 @@ from Standard.Base import all -import Standard.Base.Data.Text.Case_Sensitivity.Case_Sensitivity import Standard.Test.Extensions from Standard.Table import Table diff --git a/test/Table_Tests/src/Main.enso b/test/Table_Tests/src/Main.enso index acbf55a42e73..b67eef28c59e 100644 --- a/test/Table_Tests/src/Main.enso +++ b/test/Table_Tests/src/Main.enso @@ -1,4 +1,4 @@ -from Standard.Base import all +from Standard.Base import all hiding IO from Standard.Test import Test_Suite diff --git a/test/Tests/src/Data/Text/Parse_Spec.enso b/test/Tests/src/Data/Text/Parse_Spec.enso index 15173ae02eeb..42b925991871 100644 --- a/test/Tests/src/Data/Text/Parse_Spec.enso +++ b/test/Tests/src/Data/Text/Parse_Spec.enso @@ -1,15 +1,11 @@ from Standard.Base import all -import Standard.Base.Data.Text.Extensions -import Standard.Base.Data.Time.Date.Date -import Standard.Base.Data.Time.Time_Zone.Time_Zone import Standard.Base.Errors.Common.Syntax_Error import Standard.Base.Errors.Time_Error.Time_Error -import Standard.Base.Network.URI.URI import Standard.Test.Extensions +import Standard.Base.Data.Json.Invalid_JSON -from Standard.Base.Data.Json import Json, Invalid_JSON, JS_Object -from Standard.Base.Data.Numbers import Decimal, Integer, Number_Parse_Error +import Standard.Base.Data.Numbers.Number_Parse_Error from Standard.Test import Test, Test_Suite spec = diff --git a/test/Tests/src/Data/Text/Regex_Spec.enso b/test/Tests/src/Data/Text/Regex_Spec.enso index 53f9af3e79d9..cbd9d3e14905 100644 --- a/test/Tests/src/Data/Text/Regex_Spec.enso +++ b/test/Tests/src/Data/Text/Regex_Spec.enso @@ -1,7 +1,6 @@ from Standard.Base import all import Standard.Base.Data.Text.Span.Span import Standard.Base.Data.Text.Span.Utf_16_Span -import Standard.Base.Data.Text.Regex import Standard.Base.Data.Text.Regex.Match.Match import Standard.Base.Data.Text.Regex.No_Such_Group import Standard.Base.Data.Text.Regex.Pattern.Pattern diff --git a/test/Tests/src/Data/Text/Text_Sub_Range_Spec.enso b/test/Tests/src/Data/Text/Text_Sub_Range_Spec.enso index dba8c9b918a7..d32f684c9c93 100644 --- a/test/Tests/src/Data/Text/Text_Sub_Range_Spec.enso +++ b/test/Tests/src/Data/Text/Text_Sub_Range_Spec.enso @@ -1,6 +1,5 @@ from Standard.Base import all - -from Standard.Base.Data.Text.Text_Sub_Range import all +from Standard.Base.Data.Text.Text_Sub_Range import character_ranges from Standard.Test import Test, Test_Suite import Standard.Test.Extensions diff --git a/test/Tests/src/Data/Text_Spec.enso b/test/Tests/src/Data/Text_Spec.enso index caeb708eec36..8dae329fc6b6 100644 --- a/test/Tests/src/Data/Text_Spec.enso +++ b/test/Tests/src/Data/Text_Spec.enso @@ -1,4 +1,4 @@ -from Standard.Base import all +from Standard.Base import all hiding First, Last import Standard.Base.Data.Text.Regex.No_Such_Group import Standard.Base.Data.Text.Regex.Regex_Syntax_Error import Standard.Base.Data.Text.Span.Span @@ -7,14 +7,12 @@ import Standard.Base.Errors.Common.Index_Out_Of_Bounds import Standard.Base.Errors.Common.Incomparable_Values import Standard.Base.Errors.Common.Type_Error import Standard.Base.Errors.Illegal_Argument.Illegal_Argument -import Standard.Base.IO 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 -import Standard.Base.Data.Text.Extensions type Auto Value a diff --git a/test/Tests/src/Data/Time/Date_Spec.enso b/test/Tests/src/Data/Time/Date_Spec.enso index 55482709475b..723479443b10 100644 --- a/test/Tests/src/Data/Time/Date_Spec.enso +++ b/test/Tests/src/Data/Time/Date_Spec.enso @@ -2,7 +2,6 @@ from Standard.Base import all import Standard.Base.Errors.Common.Incomparable_Values import Standard.Base.Errors.Common.Type_Error import Standard.Base.Errors.Time_Error.Time_Error -import Standard.Base.Meta from Standard.Test import Problems, Test, Test_Suite import Standard.Test.Extensions diff --git a/test/Tests/src/Data/Vector/Slicing_Helpers_Spec.enso b/test/Tests/src/Data/Vector/Slicing_Helpers_Spec.enso index fdcd7711a992..2842241f15f9 100644 --- a/test/Tests/src/Data/Vector/Slicing_Helpers_Spec.enso +++ b/test/Tests/src/Data/Vector/Slicing_Helpers_Spec.enso @@ -1,12 +1,12 @@ from Standard.Base import all -import Standard.Base.Data.Index_Sub_Range +from Standard.Base.Data.Index_Sub_Range import sort_and_merge_ranges 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" <| - merge = Index_Sub_Range.sort_and_merge_ranges + merge = sort_and_merge_ranges merge [] . should_equal [] merge [0.up_to 0] . should_equal [] merge [0.up_to 10] . should_equal [0.up_to 10] diff --git a/test/Tests/src/Network/Http/Header_Spec.enso b/test/Tests/src/Network/Http/Header_Spec.enso index 4907810341b3..4d90cfe25762 100644 --- a/test/Tests/src/Network/Http/Header_Spec.enso +++ b/test/Tests/src/Network/Http/Header_Spec.enso @@ -1,7 +1,5 @@ from Standard.Base import all -import Standard.Base.Network.HTTP.Header.Header - from Standard.Test import Test, Test_Suite import Standard.Test.Extensions diff --git a/test/Tests/src/Network/Http/Request_Spec.enso b/test/Tests/src/Network/Http/Request_Spec.enso index ed9ba556be13..a27989dbcab5 100644 --- a/test/Tests/src/Network/Http/Request_Spec.enso +++ b/test/Tests/src/Network/Http/Request_Spec.enso @@ -2,7 +2,6 @@ from Standard.Base import all import Standard.Base.Errors.Common.Syntax_Error import Standard.Base.Network.HTTP.Form.Form -import Standard.Base.Network.HTTP.Header.Header import Standard.Base.Network.HTTP.Request.Request import Standard.Base.Network.HTTP.Request_Body.Request_Body diff --git a/test/Tests/src/Network/Http_Spec.enso b/test/Tests/src/Network/Http_Spec.enso index fd9d30300a42..57affaae8afb 100644 --- a/test/Tests/src/Network/Http_Spec.enso +++ b/test/Tests/src/Network/Http_Spec.enso @@ -2,7 +2,6 @@ from Standard.Base import all import Standard.Base.Errors.Common.Syntax_Error import Standard.Base.Network.HTTP.Form.Form -import Standard.Base.Network.HTTP.Header.Header import Standard.Base.Network.HTTP.Request.Request import Standard.Base.Network.HTTP.Request_Body.Request_Body import Standard.Base.Network.HTTP.Request_Error @@ -11,10 +10,10 @@ import Standard.Base.Network.Proxy.Proxy from Standard.Test import Test, Test_Suite import Standard.Test.Extensions -polyglot java import java.lang.System +polyglot java import java.lang.System as Java_System spec = - base_url = System.getenv "ENSO_HTTP_TEST_HTTPBIN_URL" + base_url = Java_System.getenv "ENSO_HTTP_TEST_HTTPBIN_URL" pending = if base_url != Nothing then Nothing else "The HTTP tests only run when the `ENSO_HTTP_TEST_HTTPBIN_URL` environment variable is set to URL of the httpbin server" diff --git a/test/Tests/src/Random_Spec.enso b/test/Tests/src/Random_Spec.enso index 1220e1f8fd96..7896d8efa797 100644 --- a/test/Tests/src/Random_Spec.enso +++ b/test/Tests/src/Random_Spec.enso @@ -1,8 +1,6 @@ from Standard.Base import all import Standard.Base.Errors.Illegal_Argument.Illegal_Argument -import Standard.Base.Random - from Standard.Test import Test, Test_Suite import Standard.Test.Extensions diff --git a/test/Tests/src/Semantic/Case_Spec.enso b/test/Tests/src/Semantic/Case_Spec.enso index 73a14553bbd3..11a4bb598c2b 100644 --- a/test/Tests/src/Semantic/Case_Spec.enso +++ b/test/Tests/src/Semantic/Case_Spec.enso @@ -4,11 +4,11 @@ import Standard.Base.Data.Text as Text_Module import Standard.Base.Data.Vector as Vector_Module polyglot java import java.lang.Class -polyglot java import java.lang.Object as JObject -polyglot java import java.util.Random +polyglot java import java.lang.Object as Java_Object +polyglot java import java.util.Random as Java_Random polyglot java import java.util.AbstractList polyglot java import java.util.ArrayList -polyglot java import java.util.List as JList +polyglot java import java.util.List as Java_List from Standard.Test import Test, Test_Suite import Standard.Test.Extensions @@ -108,7 +108,7 @@ spec = Test.group "Pattern Matches" <| Array_Module -> Nothing _ -> Test.fail "Expected the Array module to match." Test.specify "should be able to match on the Polyglot type" <| - random_gen = Random.new + random_gen = Java_Random.new case random_gen of Polyglot -> Nothing _ -> Test.fail "Expected a polyglot object to match." @@ -285,7 +285,7 @@ spec = Test.group "Pattern Matches" <| _ -> Test.fail "Expected to match on Any type." case ArrayList.new of - _ : JObject -> Nothing + _ : Java_Object -> Nothing _ -> Test.fail "Expected to match on java.lang.Object type." case ArrayList.new of @@ -293,7 +293,7 @@ spec = Test.group "Pattern Matches" <| _ -> Test.fail "Expected to match on java.lang.Object type." case ArrayList.new of - _ : JList -> Nothing + _ : Java_List -> Nothing _ -> Test.fail "Expected to match on java.lang.Object type." case ArrayList.new of diff --git a/test/Tests/src/Semantic/Error_Spec.enso b/test/Tests/src/Semantic/Error_Spec.enso index f9cee8c31546..6d32a7258240 100644 --- a/test/Tests/src/Semantic/Error_Spec.enso +++ b/test/Tests/src/Semantic/Error_Spec.enso @@ -9,7 +9,7 @@ polyglot java import java.lang.Long polyglot java import java.lang.NumberFormatException polyglot java import java.lang.Exception as JException polyglot java import java.util.ArrayList -polyglot java import java.util.Random +polyglot java import java.util.Random as Java_Random from Standard.Test import Test, Test_Suite import Standard.Test.Extensions @@ -87,7 +87,7 @@ spec = Test.specify "should short-circuit polyglot evaluation" <| error = Error.throw 42 - Random.new error . should_fail_with Integer + Java_Random.new error . should_fail_with Integer Test.specify "should allow to inspect their stacktrace" <| error = throw_a_bar diff --git a/test/Tests/src/Semantic/Java_Interop_Spec.enso b/test/Tests/src/Semantic/Java_Interop_Spec.enso index a1ac2a913187..0d62618f1e59 100644 --- a/test/Tests/src/Semantic/Java_Interop_Spec.enso +++ b/test/Tests/src/Semantic/Java_Interop_Spec.enso @@ -5,7 +5,7 @@ from Standard.Test import Test, Test_Suite import Standard.Test.Extensions polyglot java import java.lang.Float -polyglot java import java.lang.Integer +polyglot java import java.lang.Integer as Java_Integer polyglot java import java.lang.Long polyglot java import java.lang.String polyglot java import java.lang.StringBuilder as Java_String_Builder @@ -31,7 +31,7 @@ spec = Test.expect_panic_with (list.asList) No_Such_Method Test.specify "should auto-convert numeric types across the polyglot boundary" <| (Float.valueOf "123.3" + 5).should_equal 128.3 epsilon=0.0001 - (Integer.sum 1 2 + 3) . should_equal 6 + (Java_Integer.sum 1 2 + 3) . should_equal 6 Test.specify "should auto-convert strings across the polyglot boundary" <| (String.format "%s bar %s" "baz" "quux" + " foo").should_equal "baz bar quux foo" Test.specify "should support Java import renaming" <| @@ -41,7 +41,7 @@ spec = str = builder.toString str.should_equal "foobar" Test.specify "should invoke static methods" <| - x = Integer.valueOf 1 + x = Java_Integer.valueOf 1 x.test_me x . should_equal False Test.group "Numeric values" <| diff --git a/test/Tests/src/Semantic/Meta_Spec.enso b/test/Tests/src/Semantic/Meta_Spec.enso index 9ce2e1f17fef..8f01de54ed9b 100644 --- a/test/Tests/src/Semantic/Meta_Spec.enso +++ b/test/Tests/src/Semantic/Meta_Spec.enso @@ -1,5 +1,4 @@ from Standard.Base import all -from Standard.Base.Function import Function import Standard.Base.Errors.File_Error.File_Error import Standard.Base.Errors.Illegal_Argument.Illegal_Argument from Standard.Base.Errors.Common import Uninitialized_State @@ -9,7 +8,7 @@ polyglot java import java.lang.Long as JLong polyglot java import java.lang.Exception as JException polyglot java import java.io.IOException polyglot java import java.util.ArrayList -polyglot java import java.util.Random +polyglot java import java.util.Random as Java_Random polyglot java import java.util.Locale as JavaLocale from Standard.Test import Test, Test_Suite @@ -113,8 +112,8 @@ spec = 1.0.is_a Integer . should_be_false 1.0.is_a Text . should_be_false - random_gen = Random.new - Meta.is_a random_gen Random . should_be_true + random_gen = Java_Random.new + Meta.is_a random_gen Java_Random . should_be_true Meta.is_a random_gen Integer . should_be_false (My_Type.Value 1 "foo" Nothing).is_a My_Type . should_be_true @@ -262,7 +261,7 @@ spec = Meta.meta (Meta.type_of Integer) . methods . sort . should_equal ['parse', 'parse_builtin', 'round', 'truncate'] Test.specify "should correctly handle Java values" <| - java_meta = Meta.meta Random.new + java_meta = Meta.meta Java_Random.new java_meta . should_be_a Meta.Polyglot java_meta . get_language . should_equal Meta.Language.Java diff --git a/test/Visualization_Tests/src/Helpers_Spec.enso b/test/Visualization_Tests/src/Helpers_Spec.enso index e04f4c4b5a5c..b90da5132a95 100644 --- a/test/Visualization_Tests/src/Helpers_Spec.enso +++ b/test/Visualization_Tests/src/Helpers_Spec.enso @@ -7,7 +7,7 @@ import Standard.Visualization.Helpers from Standard.Test import Test, Test_Suite import Standard.Test.Extensions -import project.Helpers +from project.Helpers import all polyglot java import java.util.LinkedHashSet