legacy icon indicating copy to clipboard operation
legacy copied to clipboard

Datatype replication in signature does not accept a type not declared using datatype

Open pclayton opened this issue 2 years ago • 0 comments

Version

110.99.3 (Latest)

Operating System

  • [ ] Any
  • [X] Linux
  • [ ] macOS
  • [ ] Windows
  • [ ] Other Unix

OS Version

Linux fedora 6.0.18-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jan 7 17:08:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Processor

  • [ ] Any
  • [ ] Arm (using Rosetta)
  • [ ] PowerPC
  • [ ] Sparc
  • [ ] x86 (32-bit)
  • [X] x86-64 (64-bit)
  • [ ] Other

System Component

Core system

Severity

Cosmetic

Description

The right hand side of a datatype replication declaration in a signature does not accept a type not declared using datatype even though it is equal to one.

Transcript

[pclayton@fedora ~]$ /opt/smlnj/smlnj-110.99.3/bin/sml << ++++
signature TEST_A =
  sig
    datatype t1 = C1
    type t2 = t1
  end

structure TestA :> TEST_A =
  struct
    datatype t1 = C1
    type t2 = t1
  end

signature TEST_B =
  sig
    datatype t3 = datatype TestA.t2
  end
++++
Standard ML of New Jersey (64-bit) v110.99.3 [built: Thu Sep 22 14:05:58 2022]
- = stdIn:15.5-16.3 Error: rhs of datatype replication spec not a datatype
- 

Expected Behavior

Expected the right hand side of a datatype replication declaration in a signature to allow any type that is equal to a datatype, even if no declared as one.

Steps to Reproduce

The following code exhibits the problem:

signature TEST_A =
  sig
    datatype t1 = C1
    type t2 = t1
  end

structure TestA :> TEST_A =
  struct
    datatype t1 = C1
    type t2 = t1
  end

signature TEST_B =
  sig
    datatype t3 = datatype TestA.t2   (* rejected *)
  end

Additional Information

No response

Email address

[email protected]

pclayton avatar Mar 03 '23 12:03 pclayton