* Move getFilesOfInterest into the IDE, and OfInterest out into DAML
* Have the IDE mode kick all active files each time
* Add a missing .cabal dependency
* Add a missing dependencies
* Use the right thing, if any files have parse errors, then don't worry
* Print messages to stderr rather than stdout
* Add a big warning that writing to stdout is a bad plan
* Move Definition and Hover over to IDE.LSP
* Copy LanguageServer over to IDE Core, not ideal, but hard to abstract right now
* Warn that there are two copies of a given module
* Move printing out the SDK version out of language-server
For a cyclic import we actually have to write the files to disks,
otherwise we can end up with an error about the module not existing if
we check imports before the other module has been added to the VFS.
This implements part 2 of #1507 and fixes the daml-ghc-test-dev test
suite on Windows (not enabled on CI due to GRPC issues).
I have also tested this in the IDE on Windows and Linux.
This implements step 1. from #1507 and also adds a test that uses an
insane percent-encoding to verify that we can handle that.
I also tested this in the IDE on Windows and Linux.
Previously we had two layers of indirection:
In the compiler we emitted Event, we then translated this to
ClientNotification which was then translated to
FromServerMessage.
Apart from being confusing and convoluted this also resulted in us
doing the conversion to generic LSP types too late so we had scenario
specific code in places where it shouldn’t be.
This PR removes the indirection and just uses FromServerMessage
directly.
* Up-(actually down-)grade to ghc-lib-8.8.0.20190610
* A `#ifndef GHC_STABLE` removed. `ml_hie_file` must be set unconditionally
* Pass Opt_WriteHie in xFlagsSet
* Oops. Revert. This breaks Windows. Very confusing
* Disable test; track in issue https://github.com/digital-asset/daml/issues/1582
* Remove Opt_WriteHie flag (Causes test failures trying to write into a read-only filesystem in CI)
* Add an option to the IDE to disable the scenario service
This is useful for several reasons:
1. We currently have to disable all tests using the scenario service
on Windows since they are extremely flaky due to issues we haven’t
been able to solve so far. This allows us to run at least a subset of
tests on CI.
2. The LSP tests currently start a new instance of damlc for each
test (we might want to revisit this but it seems to be sufficiently
fast so far) and not starting the scenario service allows us to speed
things up a bit.
3. On large projects, this could be useful to avoid having the IDE use
up even more memory and speed things up a bit. However, this PR does
not yet expose this in a convenient way so there is more work to be
done (in separate PRs) to make that a viable option.
* Fix LSP tests on Windows
This was scary to do when we still had all the `Tagged` stuff around. Since
that stuff is gone, let's add the instances and make pretty print anything
DAML-LF related more uniform.
This needs more work but I’d like to get the initial boilerplate in
first. We will also have to make some changes to lsp-test and expand
it in various ways but those should hopefully be upstreamable.
Ironically `managed` didn't turn out to make our code more manageable
and we ended up mostly using it in very isolated places only to then
immediately convert it back to bracket-style functions using `with`.
This PR also removes the use of `managed` from the GcpLogger which was
the only other place where we are using it and it finally kills the
rather silly logic that starting up the scenario service was tied to
having an event logger.
The details are described in a comment but the short story is
that a roundtrip Uri -> FilePath -> Uri necessarily loses information
on which characters were escaped. The long-term solution here is to
avoid this roundtrip altogether but this at least fixes the issue for
now.
* Drop support for DAML-LF 1.3 from damlc
This means `damlc` now only supports versions allowing arbitrary expressions
as contract keys. This is very helpful for the upcoming new template
de/re-sugaring underpinning generic templates.
* Unpin a few DAML-LF target versions in tests
* Fix golden tests
* Adapt changelog to rebase
* Rename DAML-LF scenario tests to 1.dev
* Update tests to --target 1.dev
* Fix release notes
* Use haskell-lsp’s builtin VFS in "damlc ide"
haskell-lsp has a builtin VFS that it updates automatically on the
corresponding requests. This PR removes our own VFS implementation and
uses that builtin VFS in "damlc ide". To allow the use of functions
like setBufferModified (we use that heavily in daml-ghc-shake-test-ci)
without having to spawn an LSP server, we also add a fallback where we
spin up our own LSP implementation.
* Upgrade to ghc-lib-0.20190531
* Listen up Wally, Remove redundant commented code!
* Argh! WhattamistakeAtomakeA!
* Whitespace to force Azure pipeline to reconsider ignoring this PR
* Repackage ghc-lib, update SHAs and push again
* Refer to a non-existent release as an experiment
* Put the release number back
* Fix build of haskell-ide-core-public
* Back parseInt/parseDecimal by DAML-LF primitives when available
DAML-LF 1.5 introduces two new primitives `FROM_TEXT_INT64` and
`FROM_TEXT_DECIMAL`. We translate `parseInt` and `parseDecimal` to
these primitives when compiling to DAML-LF 1.5 or later.
This fixes#1398.
* Fix DAML-LF decoder (Scala)
* Freeze DAML-LF 1.dev into DAML-LF 1.5
In other words, we release DAML-LF 1.5.
This is required for generic templates (#1387).
* description of FROM_TEXT_INT64 & FROM_TEXT_DECIMAL
* amend version history
add ``FROM_TEXT_INT64`` and ``FROM_TEXT_DECIMAL`` in the specification changelog
* typos
* Fix markup in DAML-LF spec
* Add release notes
* Drop support for DAML-LF 1.1 from damlc
Part of #853.
* Fix docs test
* Add show party test back
* Update release notes
* Remove target version from Java codegen test
* Make the actors optional in DAML-LF's exercise instruction
If they are not present, the controllers will be filled in. Surface DAML
does this currenty anyway by fetching the contract and computing the
choice controllers before each `exercise`. This change will allow for
getting rid of the additional `fetch` preceding each `exercise`.
The compiler does not use the new form yet. I will do this in a separate
PR together with tests for the new behaviour.
This fixes#1347.
* Fix DAML-LF type checker test
* Check presence of actors for old DAML-LF versions in decoder
* Rename Value's ContractId to VContractId
* daml-lf: a bit more about PartyId
* daml-lf: Concatenable MatchingStringModule
* daml-lf make clear type used for Scenarios only
* daml-lf create ContractId, LedgerId, TransactionId
* sandbox-sql conversion util
* LedgerName -> LedgerString
* futher type cleanup in the sandbox
* daml-lf add test for LedgerString
* fixing tests
* a bit more safety in the DB
* Address Stephen's comments
* fix rebase
* More fixes for StringModule
* change length of LedgerString (256 -> 255)
* Lift restriction on serializable contract ids in DAML-LF 1.dev
In DAML-LF 1.dev, make `ContractId a` serializable whenever `a` is
serializable. This is part 2 of #1277.
* Reformat Scala
* Add changelog entry to daml_lf_1.proto
* Replace all occurrences of Tagged in DAML-LF AST with newtypes
This must end as it makes the code bases harder to understand without
adding any benefits.
* Add two more usages of mkVal
* Remove Orphans.Lib_hashable
* Remove tagged from package dependencies
* Derive stock classes as such
* Demo program for haskell-ide-core as a library
* Fix all warnings in the Demo file
* Build the IDE demo
* Give a better error message than undefined
* HLint
* Fix copyright header
* Sort the dependencies
* Improve the comment
* Bazel formatting
* Disable building on Windows until ghc-paths is fixed
* Bazel formatting
* Specify the main function
* The PackageDynFlags instances are no longer required because its not a rule result
* Move all the package custom pieces out of the ide-core
* Move the optMbPackageName out to daml-ghc
* Make sure we clean up all temporary files
* Clean up the import list
* Move runGhcFast to its one use site
* Relax syntactic restriction on contract keys in DAML-LF 1.dev
We lift the syntactic restriction that contact keys must be built using
only record constructions and projections entirely when compiling to
DAML-LF 1.dev. To make this more useful, we also search all sub-expressions
of `maintainer` in `key` during our rewriting of `maintainer` for using
`this` to using `key`.
As one of our next steps we should bring `key` into scope in `maintainer`
and perhaps deprecate the use of `this` at some point in the future.
* Fix versioning
* Adapt package validation to complext contract keys
* Refactoring: Replace Encode type class with monomorphic functions
This type class thingy was just over-engineered (by me) and made changing
the code more complicated than it needed to be. I wanted to get rid of this
for a while now...
* Remove useless language extensions to make hlint happy
The current naming suggests, the protobuf encoding and the CLI use different
textual representations of minor versions, which is not true. They only
differ in their types. We push this type conversion to the call sites
of both functions instead.
Currently, we test the default and the newest DAML-LF version. After the
recent introduction of 1.dev, this doesn't make sense anymore. Instead, we
now test the default version (which should always be the newest version)
and the dev version.
* Rename the #ifdef for GHC_STABLE
* More CPP required for GHC stable
* Add a compatibility wrapper for HIE functionality which is new in GHC HEAD
* HLint ignores
* Finish the dummy implementations
* Add a bazel build for the ide-core library against GHC
* language: fix: move interface files to a different
This fixes https://github.com/digital-asset/daml/issues/1009. We move
the created interface files and hie files to a hidden directory
".interfaces" when creating a package.
* removing the ifaceDir option and hardcode the dir
Up to now, the engine blindly assumed that contract ids pointed to
contracts of the right type. However, this assumption is faulty:
contract ids coming from the Ledger API cannot be type checked
in command translation since we need access to the contract itself
to do so.
This caused some seriously surprising / broken behavior: one could
send an exercise command with the wrong template id and still go
through, or break internal invariants about the type of choices.
This commit fixes this by checking that the type of the contract
instances we fetch is correct at runtime.
cc @hurryabit @dajmaki @remyhaemmerle-da @S11001001 @meiersi-da
* compiler: follow ghc convention and put conf files in package.conf.d dir
We follow the ghc convention and locate all .conf files for the package
database in the `package.conf.d` dir.
* addressed neil's comment
* Implement cross-package goto definition
This is more tricky than one might think at first:
- The interface files do not contain proper source spans so we cannot
use the information in there.
- We could theoretically try to get the source location from the DALFs
but that is the wrong layer and also not an option when we want to
act as a Haskell IDE.
So what we do instead is whenever we write interface files we also
write .hie files and consult those instead when we get useless source
spans otherwise.
* Move optLocateHieFile and optLocateSrcFile to a separate type
* Remove a duplicated comment
* Remove traverse from the convertor
* Move removing typeable to the converter
* Don't reexport getGhcCore
* Move coresForFile to its usage
* Just print out the GHC Core for everything, including internal modules
* Move modIsInternal out of haskell-ide-core
* Move some DynFlags setters over to Config
* Remove an unused orphan instance
* Move the orphans out to a different module
* Move functions for generating import syntax out of haskell-ide-core
* Expose fakeDynFlags as a blob, not the pieces
* Clean up the definition of fakeDynFlags
* Inline showSDocDefault
* HLint
* Fix the comment on IDE.Orphans
* Split the Options into a separate module
* Make the Logger handle live in IO
* Reduce the amount of IDE logging to just two
* Rename CompileOpts to IdeOptions
* Rename PackageState to PackageDynFlags
* Clean up setting the PackageDynFlags
* Stop hiding PackageState, we no longer clash on it
* Introduce a helper for collecting the package flags
* Move the StringBuffer conversion to its only use
* I have no idea now LPat and Pat previously managed to unify...
* Avoid using unRealSrcSpan as its only introduced for GHC 8.8
* Add some CPP to permit compiling with GHC 8.6
* Permit CPP in one more place
* Remove the requirement for Binary on Shake rules (was not used)
* Add a deriving Show on Event, easier for external integrations
* Rename GeneratePackageState to LoadPackageState and move its fields to the rule, rather than the key
* Inline getPackageState away
* Change to passing a ModRenaming to the package loader. Two reasons:
1) When loading non-DAML things we might want to omit the renaming
2) The type ModRenaming has documentation of semantics, unlike [(String, String)]
* Use DA.Prelude a lot less
* Make LANGUAGE pragmas have the right case
* Don't reexport DA.Prelude
* Remove more DA.Prelude imports
* Remove the nastiest renaming DA.Prelude
* Final removal of DA.Prelude
* Kill DA.Prelude
* Add missing dependencies
* More missing package imports
* More missing package imports
* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs
* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs
Before it was garbled and wrong:
Range: Range Start: Position Line: 2Character: 15End: Position Line: 2Character: 15
After it's correct and like it was before:
Range: 3:15-3:17
* clean up v3 contract key case in TransactionVersions
* clean up duplicate cases in ValueVersions.assignVersion
* make LanguageMinorVersion a proper ADT, aliased LanguageVersion.Minor
* port DecodeV1 to LanguageMinorVersion ADT via implicit conversion
- @remyhaemmerle-da might prefer the explicit application of Stable/Dev
* make releasePrecedes private
* add dev versions to the timeline
* copyright header for LanguageMinorVersion
* build the package database for 1.dev, support 1.dev as --target
* test presence and new-ness of "dev" in timeline
* report dev versions in engine info; note 1.dev target in release notes
* spec and governance rules on 1.dev and minor dev in general
* make the governance rule about dev more direct
* 1.x
* missed plural; thanks @leo-da
* further definition of 1.dev in LFv1 spec; thanks @remyhaemmerle-da
* Drop DAML-LF 1.0 support from compiler
This will enable us to add `Functor`, `Applicative` and `Monad` instances
for `(->) r` in the `daml-stdlib`. We'll do this in a separate PR.
* Remove codegen test for DAML-LF 1.0
* Make all Text tests be qualified to Scenario
* Remove the big list of tests from Text test
* Add DA.Text.reverse
* Move LitString decoding out to UtilGHC
* Rename the functions to match their GHC counterparts
* Fix pretty printing of LF strings containing weird characters, e.g. NUL or "
* Move to using an unpackCStringUtf8 which copes with GHC-style nuls
* Add lots of tests around NUL characters
* Use a safer CString function
* Delete an entirely unused module
* Delete an entirely unused module
* Switch the compiler to use EUnit over mkEUnit
* Delete an unused module
* Whitespace only
* Clean up the API for World, don't expose the internals, better creation functions
* Clean up the type checker environment, don't expose the internals of Gamma, add a few helper functions
* Delete unused functions
* Explicit module export lists
* Fix the nub replacement hints
* Turn on the warning that we require module export lists
* Add an explicit export list
* Move from prettyDiagnostic to prettyDiagnostics
* Remove as much pretty print stuff as we can
* Try moving duplicate named functions with similar semantics and identical types to different names
* Change to returning pretty printed outputs from Diagnostics
* Remove a redundant import
* Make the ScenarioService take an IO callback, not STM
* Remove a redundant space
* Use IO in preference to STM where we really don't care which is in use
* #564, always print out diagnostics for tests
* #564, fix getting the scenario names so if they can't be computed you give an answer
* Add a proper data type to represent pass/fail in the tests
* Centrailse printing a failure message
* Pull the test execution into a separate file, ensuring it always gives back an exit code
* Use nubOrd instead of Set
* Clean up how we figure out which files to test
* Fail if there are any errors
* Delete all the brittle failure tracking stuff
* Rename the compiler handle to h
* Only print out the successful results to stdout, since the unsuccessful ones end up in diagnostics
* Make JUnit output still print out the test results
* Make JUnit print out all the details
* Delete the stdio command path
* Break the bigger pieces apart in the test runner
* Inline testJUnit
* Shorten to UseColor
* Shorten to color
* Inline and comment part of the JUnit tests
* HLint
* Update daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Test.hs
Co-Authored-By: neil-da <35463327+neil-da@users.noreply.github.com>
* Fix an HLint refactoring snafu
* Fix up the damlc tests
* Tighten up a test by demanding it throws ExitFailure
The only usage of `encodeHash` is in `DA.Daml.LF.Proto3.Archive`. This used
to be different in the past but since it isn't anymore there's no more
justification for a separate module for a single function.
* removing major LF dev version from Haskell proto codecs
* removing major LF dev version from scenario service client
* missed import
* remove Scala support for dev major version; remove --allow-dev option from sandbox cli
* Version.minorFromCliOption function
* don't build daml-stdlib artifacts for dev major
* remove damlc CLI --target dev
* release note about removed dev major LF version
* governance now discusses minor dev, no more major dev
* don't build from daml_lf_dev.proto anymore
* remove daml_lf_dev.proto
* raise deprecated release
* reserve 9999 in the ArchivePayload sum, as suggested by @bitonic
* use reserved proto keyword, as suggested by @bitonic
- `reserved` cannot occur within `oneof` block
* remove --allow-dev test
* dev removal release note followed the previous release; move it back to HEAD
* Move the IdeResult term into the A data type
* Nothing ever consults the errors stored in A, so stop storing them
* Use the new Shake MonadFail Rules instance
* Document the information in the Shake database
* More documentation of the data in the Shake service
* Change getValues to avoid getting the diagnostics
* Avoid fmap over a pair, a bit weird
* Stop using Template Haskell to derive type class instances
Template Haskell is notorious for causing slow build times. That's why we
remove the `makeInstances*` family of functions and use proper `deriving`
clauses instead.
* Make hlint happy
* Make hlint even more happy
* Derive Data
* Remove ToJSON instances from DAML-LF AST
* Clean up how we check DAML-LF feature support in damlc
Currently, we have a predicate that tells us whether a DAML-LF version
supports a specific feature. We replace this by a data type which captures
the name of a feature and the minimal DAML-LF version which supports it.
* Rename featureDisjunctionChoices into featureFlexibleControllers
* Error only once
Co-Authored-By: hurryabit <martin.huschenbett@posteo.me>
* Move to using proto3-wire from upstream
* Move to upstream proto3-suite, with some custom patches in my fork
* Delete the BUILD.bazel for hte proto3 stuff, not used and the test was failing
* Delete the old proto3-wire and proto3-suite forks
* Delete proto3-wire
* Prettify BUILD.bazel files, sort the deps
* Remove some special cases from the license checker
* Delete unused Nix files from grpc-haskell
* Switch to upstream proto3-suite
* Make old-time work on Windows
* Formatting
* Patch rules_haskell to use a response file for -optP to avoid overflowing argument size limits on Windows
* Update 3rdparty/haskell/BUILD.old-time
Co-Authored-By: neil-da <35463327+neil-da@users.noreply.github.com>
* Update the comments in old-time
* Use the revised location of proto3-suite
* GenTransaction.WithTxValue alias
* undo parts of parent dealing explicitly with serialization
* use GenNode.WithTxValue more often
* use Node*.WithTxValue more often
Add a check to the Haskell implementation of the DAML-LF type checker to
make sure that the current DAML-LF version supports contract keys when they
are encountered.
* Fix termination of scenario service on Windows
The lack of a proper Windows IO manager resulted in us being unable to
kill the conduits reading the output of the scenario service so `damlc
test` and `damlc ide` blocked forever. This PR fixes the problem by
shutting down the scenario service (by closing its stdin) before
killing the conduits .
* Use fail instead of error
* Add debugging output
* Remove debug output
* Bump timeout of perf test
* Add buildifier targets.
The tool allows to check and format BUILD files in the repo.
To check if files are well formatted, run:
bazel run //:buildifier
To fix badly-formatted files run:
bazel run //:buildifier-fix
* Cleanup dade-copyright-headers formatting.
* Fix dade-copyright-headers on files with just the copyright.
* Run buildifier automatically on CI via 'fmt.sh'.
* Reformat all BUILD files with buildifier.
Excludes autogenerated Bazel files.
* Add location information to DAML-LF produced by damlc
This is required to get error locations in the scenario view. Rigth now,
the location information for `create`/`exercise` still points to the
template/choice. I'll fix that in a separate PR.
* Fix test expectations
* Fix more tests
* Do not divulge contracts to observers in nonconsuming exercises
Disables support for non-default ledger feature flags, as they
are meaningless since ledger server logic does not respect the flags.
Instead of large refactoring to add support for the old flag settings,
it is best to disallow the deprecated flags, and later on phase out the
flags completely.
Re-enables test_divulgence_of_token in sandbox semantic tests.
Fixes#157.
* purge LedgerFlags entirely...
...since we only support one version of them anyway, and clearing them
* updated release notes
* Turn off -Woverlowed-literals in damlc
This flag does not play well with location information obtained via `-ticky`.
Also, the error message you get from overflowed literals suggests to use
`-XNegativeLiterals`, which is a bad idea since it changes the meaning of
`(-1)` from `\x -> x - 1` to `negate 1`.
* Fix module name in test
Co-Authored-By: martin-drhu-da <31696042+martin-drhu-da@users.noreply.github.com>
* HOTFIX damlc: allow for passing options to the underlying GHC
As `damlc` is based on GHC, it "understands" all options that GHC understands.
This PR introduces a way to use GHC options that are not exposed by the `damlc`
driver, by passing any number of `--ghc-option CUSTOM_OPTION` on the command line.
The code uses the GHC function which parses options inside files, so
prohibiting a few options that we would not want to expose (package db, output
file, etc).
All warnings that GHC emits during flag processing are presented to the user.
If an option contradicts a DAML compiler setting, the compilation will be
aborted with a GHC exception (calls makeDynFlagsConsistent internally).
* HOTFIX damlc: small clean-up
* Remove all traces of the long gone value restriction
We remove the value check since it has only been used by one `damli` command.
We also remove the constant folding from the DAML-LF simplifier. It is more
likely to diverge from the semantics of the interpreter than to do any good.
* Make hlint happy
This was used by the old DAML-LF based record constructor/projection
inliner. We'bve recently replaced by an inlining mechanism which is part
of the conversion from GHC Core to DAML-LF.